← ClaudeAtlas

pw-locator-fixerlisted

Audits a Playwright spec or Page Object for brittle locators — XPath, CSS classes, nth-child/positional selectors, deep DOM chains — and proposes resilient, JavaScript- or TypeScript-matched replacements without changing test intent. Use when an SDET says "fix these locators", "my selectors are flaky", "replace XPath with getByRole", "review the selectors in this Page Object", or reports a strict-mode violation. Produces a before/after rewrite map plus reasoning — the engineer verifies each swap against the real DOM.
Shivani26Singh/skill-library · ★ 1 · AI & Automation · score 65
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