Selenium WebDriver 4

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.

Test URL
/lab/qa-automation-write-an-xpath-using-contains-and-text

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

  1. 1Open TEST_URL.
  2. 2Locate the promo with //strong[contains(text(),'Free shipping')] and assert it is displayed.
  3. 3Locate the footer link with //a[contains(text(),'support')] and click it.
  4. 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 · QA Automation · Locators & the DOM