Recall & Review
beginner
What does 'Find element by link text' mean in Selenium?
It means locating a web page element by matching the exact visible text of a hyperlink (anchor tag).
Click to reveal answer
beginner
Which Selenium method is used to find an element by its link text in Python?
driver.find_element(By.LINK_TEXT, "exact link text")
Click to reveal answer
intermediate
Why should you prefer 'link text' locator only when the link text is unique?
Because if multiple links share the same text, Selenium will find only the first one, which may cause incorrect element selection.
Click to reveal answer
intermediate
How is 'Find element by partial link text' different from 'Find element by link text'?
Partial link text matches only part of the link's visible text, while link text requires the full exact text.
Click to reveal answer
beginner
Show a simple Python Selenium code snippet to click a link with text 'Home'.
from selenium.webdriver.common.by import By
link = driver.find_element(By.LINK_TEXT, "Home")
link.click()Click to reveal answer
Which Selenium locator finds an element by the exact visible text of a link?
✗ Incorrect
By.LINK_TEXT locator matches the exact visible text of an anchor tag.
What happens if multiple links have the same link text and you use find_element(By.LINK_TEXT, ...)?
✗ Incorrect
find_element returns the first matching element found in the DOM.
Which method would you use to find a link containing part of the text 'Contact'?
✗ Incorrect
PARTIAL_LINK_TEXT matches any link containing the given substring.
Which import is necessary to use By.LINK_TEXT in Selenium Python?
✗ Incorrect
By is imported from selenium.webdriver.common.by to specify locator strategies.
What is the correct way to click a link with text 'About Us' using Selenium Python?
✗ Incorrect
The modern Selenium syntax uses find_element with By.LINK_TEXT and then calls click().
Explain how to locate and click a link by its exact text using Selenium in Python.
Think about the steps to find and interact with a link element.
You got /3 concepts.
What are the advantages and limitations of using 'Find element by link text' locator?
Consider when this locator works best and when it might cause problems.
You got /3 concepts.