A published npm package (v1.0.0) that fixes broken Playwright selectors. It fingerprints elements while your test suite is green, and when a selector breaks, matches the element's new identity and suggests the fix — as a diff on your pull request. It never edits your source files.
Status: v1.0.0 · stable public API · security-reviewed · MIT
| What | Where |
|---|---|
| 📦 Package | https://www.npmjs.com/package/playwright-eir |
| 💻 Repository + full docs | https://github.com/Someone-anon-coder/Eir |
| 🎬 Live demo (a real PR comment from the tool) | https://github.com/Someone-anon-coder/Eir/pull/15 |
| ✍️ The build story (Medium) | https://computer-info-1.medium.com/building-playwright-eir-a-self-healing-locator-engine-with-a-measured-0-false-heal-rate-70eac1c27bf7 |
| 🚀 Release notes | https://github.com/Someone-anon-coder/Eir/releases/tag/v1.0.0 |
// before
import { test, expect } from "@playwright/test";
// after
import { test, expect } from "playwright-eir";
That's the whole integration. Run your suite green once (calibration), and from then on, broken selectors produce suggestion diffs with confidence scores instead of just red failures.
Seed-42, 8-class mutation benchmark — reproducible with one command (pnpm bench:all --seed 42):
| Mutation class | Heal rate | False-heal rate |
|---|---|---|
| id-rename | 75.0% | 0.0% |
| text-change | 87.5% | 0.0% |
| tag-swap | 100.0% | 0.0% |
| class-shuffle | 25.0% ⚠️ | 0.0% |
| sibling-reorder | 0.0% ⚠️ | 0.0% |
| wrapper-inject | 100.0% | 0.0% |
| near-duplicate-sibling-swap | 25.0% | 0.0% |
| compound-release | 50.0% | 0.0% |
False-heal rate is 0.0% in every class — the number the project is actually optimized for: a wrong heal that silently passes is worse than an honest failure. The two ⚠️ rows are documented structural ceilings (explained in the repo's Known Limitations), not tuning gaps — and stating them plainly is part of the point.
Every successful interaction captures a compact fingerprint of the element (tag, stable attributes, text, label association, ancestor context, sibling position, quantized geometry) into committed, git-diffable JSON. On failure, a triage funnel confirms the failure is genuinely locator drift, then six deterministic similarity scorers rank every candidate in the live DOM against the fingerprint. Two gates stand between a match and a heal: a confidence threshold and a decision margin (the gap to the runner-up — what stops near-duplicate elements from being confused). An optional heal-and-continue mode retries the action and then verifies the post-condition (did the route/DOM actually change the way it did during calibration) before accepting the heal. Results flow into a custom reporter and a GitHub Action that maintains a single auto-updating PR comment.
isVisible(), count() etc. are structurally incapable of triggering healing.