TestDino

Free Tools / Playwright Locator Playground

Playwright Locator Playground

Paste HTML, type a Playwright locator, and see exactly how many elements it matches. Spot ambiguous locators before they break your tests.

Your HTML

Paste a snippet. A sample login form is loaded to start.

Live

Match result

No match
0

Nothing matched. Check the locator and try a preset below.

Cleaner alternatives

No alternatives to suggest until your locator matches an element.

Runs in your browser. Your HTML is not uploaded anywhere.

How this works?

How the playground parses locators and resolves them against your HTML.

Paste your HTML

Drop in any HTML snippet from your app. The playground parses it in your browser so your markup never leaves your machine.

Type a locator expression

Enter any Playwright locator: getByRole, getByText, getByLabel, getByTestId, locator with a CSS selector, or locator with an XPath expression.

See matches instantly

The tool resolves the locator against your HTML and shows a match count. One match means a unique, stable locator. More than one means you need to narrow it.

Copy a cleaner alternative

When your locator matches, the playground suggests up to three better alternatives ranked by Playwright best practices. Copy any suggestion straight into your test.

FAQs

getByRole, getByText, getByLabel, getByPlaceholder, getByTestId, getByAltText, getByTitle, locator with a CSS selector, and locator with an XPath expression via the xpath= prefix.