Challenge - 5 Problems
Link Text Locator Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ locator
intermediate2:00remaining
Locate element using exact link text
Which Selenium Python code snippet correctly finds a link with the exact text
"Home Page"?Attempts:
2 left
💡 Hint
Use the locator that matches the full visible text of the link.
✗ Incorrect
The
By.LINK_TEXT locator finds elements by their exact visible link text. Partial link text matches substrings, and ID or class name locators do not match link text.❓ Predict Output
intermediate2:00remaining
Output of finding link by partial text
What will be the output of this Selenium Python code if the page contains a link with text "Contact Us Today"?
Selenium Python
element = driver.find_element(By.PARTIAL_LINK_TEXT, "Contact") print(element.text)
Attempts:
2 left
💡 Hint
Partial link text matches any part of the link's visible text.
✗ Incorrect
Using
By.PARTIAL_LINK_TEXT with "Contact" finds the link containing that substring. The element.text returns the full visible text of the link, which is "Contact Us Today".❓ assertion
advanced2:00remaining
Valid assertion for link text presence
Which assertion correctly verifies that a link with text "About Us" is present on the page using Selenium Python?
Selenium Python
element = driver.find_element(By.LINK_TEXT, "About Us")Attempts:
2 left
💡 Hint
Check the visible text of the found element.
✗ Incorrect
The
element.text property returns the visible text of the link. To verify the link text, assert it equals the expected string. Checking href attribute or display status does not confirm the link text.🔧 Debug
advanced2:00remaining
Identify error in link text locator code
What error will this Selenium Python code raise?
driver.find_element(By.LINKTEXT, "Services")
Selenium Python
driver.find_element(By.LINKTEXT, "Services")Attempts:
2 left
💡 Hint
Check the spelling of the locator constant.
✗ Incorrect
The correct locator constant is
By.LINK_TEXT with an underscore. Using By.LINKTEXT causes an AttributeError because that attribute does not exist.❓ framework
expert2:00remaining
Best practice for waiting for link by text
In Selenium Python, which code snippet correctly waits up to 10 seconds for a link with text "Login" to be clickable before clicking it?
Attempts:
2 left
💡 Hint
Use explicit waits with expected conditions for clickable elements.
✗ Incorrect
Option B uses explicit wait for the element to be clickable by exact link text, then clicks it. Option B does not wait and may fail if element is not ready. Option B uses fixed sleep which is inefficient. Option B waits for presence but not clickability and uses partial link text which may match multiple elements.