Build a resilient checkout locator
Medium70 pts~25 min
- Resilient locators
- data-testid
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
Click Checkout with a locator that survives styling and layout changes.
Your task
- 1Open TEST_URL and add one product with the first
.add-to-cartbutton. - 2Locate Checkout by
[data-testid='checkout'], its aria-label “Proceed to checkout” or its id — not by position or styling classes. - 3Click it and assert the status text “Checkout started with 1 item” is displayed.
- 4Assert
#cart-countshows “1”.
Acceptance criteria
- Checkout is located by a stable attribute
- No absolute XPath is used
#cart-countshows “1”- At least 2 assertions pass
Selenium WebDriver 4 · QA Automation · Locators & the DOM