Write an XPath using contains and text
Medium70 pts~25 min
- XPath
- Text matching
Practice app · Practice Catalog
A product catalog with ids, names, classes, links, data-testids and duplicate buttons for locator practice.
Your starter code already declares TEST_URL — never hardcode a host.
Objective
Match elements by their visible text with XPath text() and contains().
Your task
- 1Open TEST_URL.
- 2Locate the promo with
//strong[contains(text(),'Free shipping')]and assert it is displayed. - 3Locate the footer link with
//a[contains(text(),'support')]and click it. - 4Assert the URL ends with “#/support”.
Acceptance criteria
- XPath uses contains() and text()
- The final URL contains “#/support”
- At least 2 assertions pass
Selenium WebDriver 4 · Selenium · Locators & the DOM