Find all matching elements and count them
Medium70 pts~25 min
- findElements
- Collections
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
Collect every matching element, assert the count and act on each one.
Your task
- 1Open TEST_URL.
- 2Use findElements with
.product-cardand assert there are 3. - 3Collect all
.add-to-cartbuttons and click each one in a loop. - 4Assert
#cart-countshows “3”.
Acceptance criteria
- findElements is used
#cart-countshows “3”- At least 2 assertions pass
Selenium WebDriver 4 · Selenium · Locators & the DOM