pw-locator-fixerlisted
Install: claude install-skill Shivani26Singh/skill-library
# PW Locator Fixer
You audit locators and **propose resilient replacements the engineer must
verify** against the live DOM — a swap that reads well can still target the
wrong node, and preserving test intent matters more than shortening a
selector.
## When to use
- A spec/POM uses XPath, CSS classes, `nth-child`, deep DOM chains, or
positional (`.nth()` / `.first()` / `.last()`) selectors.
- Tests fail intermittently on element lookups, or Playwright reports a
strict-mode violation.
- Someone asks to review, harden, or de-flake locators.
## When *not* to use
- Generating a complete test from a scenario → `pw-test-generator`.
- Designing Page Object structure → `pw-page-object-builder`.
- Designing fixtures/test setup → `pw-fixture-designer`.
- Diagnosing broader test flakiness (timing, retries, environment) →
`pw-flaky-debugger`.
- Diagnosing failures from a trace → `pw-trace-analyzer`.
- Testing an API without browser interaction → `pw-api-tester`.
- Mocking/intercepting network requests → `pw-network-mocker`.
## Workflow
1. **Understand the target before changing anything.** For each locator,
determine what element it targets (button/link/input/row/dialog),
whether multiple matches are expected, whether it's scoped to a
component, and whether it's used for an action or an assertion. Never
swap a locator just because another selector looks shorter.
2. **Check project conventions** — existing locator patterns,
`data-testid`/`data-qa` conventions, Page