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.
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
- 1Open TEST_URL.
- 2Locate the heading with
//h3[text()='Playwright Tee']. - 3Use an axis (
ancestor::articleorparent::) to reach its card, then its “View details” link. - 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 · Selenium · Locators & the DOM