Free XPath & CSS Selector Tester
Paste your HTML, test an XPath or CSS selector against it, and see exactly what it matches — plus a stability score and ready-to-paste Selenium, Playwright, Cypress and WebdriverIO code. Nothing you paste here leaves your browser.
—
How this XPath and CSS selector tester works
Your markup is parsed into an isolated, in-memory document using the browser's own DOMParser, then matched with the native querySelectorAll (for CSS) or document.evaluate (for XPath). Because both are the same engines Chrome runs on a real page, a selector that matches here matches in your test run.
The preview pane renders your HTML inside a fully sandboxed iframe with scripting disabled, and any tags are stripped before rendering. Nothing you paste is uploaded, logged, or stored — it never leaves the tab.
The stability score is the part most selector testers skip. A selector can match perfectly today and still break tomorrow: absolute XPath from /html, positional indexes like [3] or :nth-child(2), build-generated class names such as css-1f8dk2b, and assertions on visible text are all common causes of flaky tests. The score flags those patterns and tells you what to anchor on instead.
Is this XPath and CSS selector tester free?
Yes, completely free with no login, no signup, and no usage limit.
Does my HTML get uploaded to a server?
No. Parsing, matching, and rendering all happen locally in your browser. There is no network request involved in testing a selector, so you can safely paste markup from an internal or pre-release environment.
Can I test a selector against a live URL instead of pasted HTML?
Not in this version. Fetching an arbitrary URL from the browser is blocked by CORS, and doing it server-side introduces real abuse risk, so this tool intentionally works on pasted markup only. In Chrome you can grab the markup you need with right-click, then Inspect, then Copy outer HTML on the container element.
What makes a selector stable versus brittle?
Stable selectors anchor on something a developer set deliberately and rarely changes: a dedicated test attribute such as data-testid, a meaningful id, or an ARIA role and accessible name. Brittle selectors depend on things that shift with every layout tweak or build: absolute paths from the document root, sibling positions, generated class hashes, and visible copy that changes with edits or translation.
Does XPath work the same in Playwright and Selenium?
The expression itself evaluates the same way, since both drive the browser's own XPath engine. The wrapper syntax differs: Selenium uses By.xpath(...), while Playwright takes an xpath= prefix inside page.locator(...). Cypress has no built-in XPath support and needs a plugin, which is why the snippet panel notes it.
Hand-tuning locators after every UI change? ContextQA heals them for you.
ContextQA's self-healing locators re-identify an element when the DOM shifts, so a class-name change or a reordered row stops breaking your suite overnight.
See self-healing in action