Selenium WebDriver 4

Locate a nested element from a parent

Medium70 pts~25 min
  • Scoped search
  • WebElement
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-locate-a-nested-element-from-a-parent

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

Objective

Find a product card first, then search only inside it.

Your task

  1. 1Open TEST_URL and find the card [data-testid='product-tqa-300'].
  2. 2From that card element, find .product-price and assert it is “$49.00”.
  3. 3From the same card, find .add-to-cart and click it.
  4. 4Assert #cart-count shows “1”.

Acceptance criteria

  • findElement is called on a parent element
  • #cart-count shows “1”
  • At least 2 assertions pass

Selenium WebDriver 4 · QA Automation · Locators & the DOM