Playwright

Target elements by role

Easy30 pts
  • getByRole
  • Accessibility
  • Accessible Name
  • Auto-waiting
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-role

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

Objective

Locate and verify the checkout button using its accessible role and name.

Your Task

  1. 1Navigate to the practice catalog page at TEST_URL.
  2. 2Locate the checkout button (#checkout-button) using its accessible role of 'button' and accessible name matching 'Proceed to checkout' or 'Checkout'.
  3. 3Assert that the checkout button is visible and enabled on the page.

Validation Checks

  • Practice catalog application is loaded at TEST_URL
  • Checkout button is located by its accessible role and name
  • Checkout button (#checkout-button) is verified as visible and enabled
  • At least 1 assertion passes

Playwright · Playwright Practice Track · Locators & auto-waiting