Inspect brittle CSS/XPath selectors and waitForTimeout calls in this free single-snippet
browser sandbox. Upgrade to the $7.00 Pro CLI Kit on Polar.sh for recursive repo scanning
(JS/TS + Playwright Python), SARIF 2.1.0 GitHub Code Scanning, two-stage DOM healing, and safe
--apply patching with .bak backups.
page.content())| Rule | Line | Issue | Recommended Replacement |
|---|---|---|---|
| PW003 | 4 | div.actions > button:nth-child(2) |
page.getByTestId('complete-checkout') (unique: 1 match) |
| PW004 | 8 | button.css-1x2y3z |
page.frameLocator('#pay').getByTestId('complete-checkout') (unique: 1 match) |
| PW006 | 9 | #customer-email |
page.getByTestId('email-input') (unique: 1 match) |
| PW006 | 10 | button |
page.getByRole('button', { name: 'Save', exact: true }) (ambiguous: 2 matches) |
| PW005 | 10 | Chained .nth() |
Filter by accessible name or .filter({ hasText: '...' }) (positional chain) |
| PW001 | 11 | Hardcoded .waitForTimeout() |
await expect(locator).toBeVisible() (auto-retry assertion) |
--- a/snippet.spec.ts
+++ b/snippet.spec.ts
- page.locator( 'div.actions > button:nth-child(2)' )
+ page.getByTestId('complete-checkout')
- page.frameLocator('#pay').locator('button.css-1x2y3z')
+ page.frameLocator('#pay').getByTestId('complete-checkout')
- page.locator('#customer-email')
+ page.getByTestId('email-input')
Full bundle adds recursive repository scanning, Playwright-Python support (get_by_role),
SARIF 2.1.0 GitHub Code Scanning, capture_dom_on_fail.ts, and safe --apply patching:
python pw_audit.py tests/ --dom test-results/dom-snapshots/checkout.html --format sarif --out playwright-audit.sarif python trace_diff.py --dom sample_dom.html --selector "button.btn-legacy-checkout-hash" --hint "Complete Order"