BeginnerPW-LOC-00115 minutesPlaywright

Locate the primary action by role

A semantic button must remain findable after its CSS class changes.

  • locators
  • accessibility

Objective

What to automate

Click the Good DOM primary action using its accessible role and name.

Preconditions and test data

Preconditions

  • Use a fresh isolated Practice Lab browser context.
  • Open the fixture identified by FX-LOCATOR-001.

Test data

  • button name: Submit order

Expected result

The Good DOM result reports that the order was submitted.

Progressive hints

Hint 1

Start from the Good DOM region.

Hint 2

Prefer getByRole over a CSS class.

Hint 3

Scope the button name exactly inside the comparison card.

I’ve tried it — show solution
  1. Start from the Good DOM region.
  2. Prefer getByRole over a CSS class.
  3. Scope the button name exactly inside the comparison card.