Objective
What to automate
Use the trace DOM snapshot to diagnose strict-mode ambiguity and scope the locator.
Preconditions and test data
Preconditions
- Use a fresh isolated Practice Lab browser context.
- Open the fixture identified by FX-LOCATOR-001.
Test data
starter: examples/debugging/wrong-locator.spec.ts
Expected result
The diagnosis identifies repeated text; the repaired test scopes by region and role.
Progressive hints
Hint 1
Inspect the strict-mode error and locator count.
Hint 2
Use the trace snapshot to find the intended card.
Hint 3
Scope to Good DOM, then use getByRole with the accessible name.
I’ve tried it — show solution
- Inspect the strict-mode error and locator count.
- Use the trace snapshot to find the intended card.
- Scope to Good DOM, then use getByRole with the accessible name.
The deliberately failing starter is in examples/debugging/wrong-locator.spec.ts inside the TypeScript starter ZIP.