Selenium WebDriver 4

Traverse to a parent with XPath axes

Medium70 pts~25 min
  • XPath axes
  • DOM traversal
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-traverse-to-a-parent-with-xpath-axes

Your starter code already declares TEST_URL — never hardcode a host.

Objective

Start from a product name and walk up to its card to reach that card’s link.

Your task

  1. 1Open TEST_URL.
  2. 2Locate the heading with //h3[text()='Playwright Tee'].
  3. 3Use an axis (ancestor::article or parent::) to reach its card, then its “View details” link.
  4. 4Click it and assert the URL ends with “#/products/tqa-200”.

Acceptance criteria

  • An XPath axis is used
  • The final URL contains “#/products/tqa-200”
  • At least 1 assertion passes

Selenium WebDriver 4 · QA Automation · Locators & the DOM