Playwright

Target elements by test id

Easy30 pts
  • getByTestId
  • data-testid
  • Resilient Automation
Practice app · Practice Catalog

A product catalog with ids, names, classes, links, data-testids and duplicate buttons for locator practice.

Test URL
/lab/playwright-target-elements-by-test-id

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

Objective

Locate a specific product card using dedicated test identifiers and verify its content.

Your Task

  1. 1Navigate to the practice catalog page at TEST_URL.
  2. 2Locate the product card using its test identifier 'product-tqa-100'.
  3. 3Assert that the product card ([data-testid='product-tqa-100']) is visible.
  4. 4Assert that the product card contains the text 'Selenium Mug'.

Validation Checks

  • Practice catalog application is loaded at TEST_URL
  • Product card is located using test identifier 'product-tqa-100'
  • Product card is verified as visible
  • Product card contains the text 'Selenium Mug'
  • At least 2 assertions pass

Playwright · Playwright Practice Track · Locators & auto-waiting