What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Use Selenium’s By.LINK_TEXT to locate a link by its full visible text, or By.PARTIAL_LINK_TEXT when only a reliable phrase within the link is known. Both strategies target links—not buttons or arbitrary text—and a singular find_element returns the first match it finds.
Find a link by its visible text in Python
Import Selenium’s By class, then pass the locator strategy and the text to driver.find_element:
As an Amazon Associate I earn from qualifying purchases.
from selenium.webdriver.common.by import By
# Match the link using its full visible text.
link = driver.find_element(By.LINK_TEXT, "Selenium Official Page")
# Match a link whose visible text contains this phrase.
link = driver.find_element(By.PARTIAL_LINK_TEXT, "Official Page")
These examples assume driver is an already-created WebDriver and the page has loaded. Selenium’s locator documentation uses these strategies to find a link whose href is https://www.selenium.dev/; that is documentation example code, not a guarantee about another page’s content. See Selenium’s Locator strategies documentation for examples in Python, Java, JavaScript, C#, Ruby, and other bindings.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Choose exact text or partial text
Use exact link text when the label is stable
By.LINK_TEXT matches the anchor’s visible text as a whole. It is the more specific choice when the page reliably uses the same complete label. A changed label can make the locator stop matching.
#1 Best Overall
Use partial link text when only a fragment is reliable
By.PARTIAL_LINK_TEXT matches an anchor when its visible text contains the supplied search string. This is useful when the rest of the label varies, but a broad fragment can match several links. Choose a distinctive substring where possible.
Remember that these strategies locate links only
Link-text strategies apply to anchor links, not any element that happens to display words. They do not locate buttons, headings, or arbitrary containers by their text. For a non-link element, choose a locator strategy suited to that element—for example, a stable ID or an appropriate CSS selector.
Rank #2
Handle duplicate matches safely
A call to find_element returns the first matching element in its search context. If more than one link has the same text or contains the same fragment, it can select a different link than intended without signaling that the match was ambiguous.
Use find_elements to inspect all matching links before choosing one:
Rank #3
matches = driver.find_elements(By.PARTIAL_LINK_TEXT, "Account")
for link in matches:
print(link.text, link.get_attribute("href"))
Once you know which link you need, narrow the locator using a stable attribute or a more specific context rather than relying on a broad substring.
When to use an ID or CSS selector instead
Selenium’s official Tips on working with locators guidance says that unique, consistently predictable HTML IDs are generally preferred. If no suitable ID exists, Selenium recommends a well-written CSS selector. Keep locators compact and readable; avoid complex DOM traversal when a simpler locator identifies the element.
Rank #4
- Prefer an ID when it is unique and predictably assigned.
- Use exact link text when the full visible label is stable and distinctive.
- Use partial link text when only a distinctive fragment remains stable.
- Use CSS or another suitable strategy for non-links, or when it identifies the intended element more reliably.
Troubleshoot a link-text locator that does not work
No element is found
Confirm the element is a link and that the visible label or substring matches the current page. If the link is not yet present when the lookup runs, wait for the page state your test requires before locating it. Link text is not a locator for buttons or other non-anchor elements.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsThe wrong link is selected
Check whether the search fragment matches more than one link. Use find_elements to inspect candidates, then narrow the match with a more distinctive label, stable ID, CSS selector, or suitable search context.
Best Value
The label changes between runs
Exact link text depends on the full visible label; partial link text still depends on its chosen fragment. If the text is dynamic or frequently revised, prefer a stable, unique ID or a well-written CSS selector when the page provides one.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Or skip the browser setup
If your goal is a screenshot rather than interacting with a link, ScreenshotNeo can capture a page with one request. Its API removes cookie/consent banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, and failed loads are not billed. An MCP server lets AI agents use screenshot tools, and the free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000.
See the ScreenshotNeo API documentation for request options. Example cURL request:
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchcurl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




