Playwright

Assert ARIA roles and names

Medium70 pts
  • getByRole
  • ARIA
  • Accessible Names
Practice app · Practice Catalog

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

Test URL
/lab/playwright-assert-aria-roles-and-names

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

Objective

Locate and verify elements using their accessible ARIA roles and accessible names.

Your Task

  1. 1Navigate to the locators scenario page.
  2. 2Locate the search input using its role ('textbox') or placeholder ('Search products').
  3. 3Locate the checkout button #checkout-button using its role ('button') and accessible name.
  4. 4Assert that both elements are visible.

Validation Checks

  • Uses getByRole or getByPlaceholder to target elements by accessible attributes
  • Search field and checkout button verified
  • At least 2 assertions pass

Playwright · Playwright Practice Track · Visual & accessibility