Stable Locators for Selenium, Playwright and Cypress
Flaky tests usually start with brittle locators. This tool reads the HTML you paste, lets you click any element, and builds a ranked list of ways to find it: test IDs, roles and labels, attributes, CSS paths and XPath. Every locator is run against your page so you know whether it matches exactly one element.
What you can do
- Click an element in a live preview, or choose it from the element tree.
- Locators ranked unique first and then by stability: test IDs, ids, roles, labels, names, text, classes and positions.
- Generated code for Playwright (JS and Python), Selenium (Python and Java) and Cypress.
- Warnings for auto-generated ids and positional selectors that break when the layout changes.
- A box to test your own CSS or XPath and highlight what it matches.
Good to know
- Prefer test ids, roles and labels. Text, classes and positions change more often.
- Auto-generated ids (like btn-48291 or css-1x2y3z) are marked fragile, and utility classes such as Tailwind’s are skipped when building CSS.
- Dynamic content added by JavaScript isn’t in pasted HTML. Copy the rendered HTML from your browser’s DevTools (Elements → Copy outerHTML) for the most accurate results.
- Shadow DOM and iframes inside the pasted HTML aren’t analysed. Your HTML never leaves your browser.