XPath and CSS Selector Tester
Test XPath and CSS selectors against HTML or XML samples before committing automation scripts. Free online XPath tester.
Online XPath tester and CSS selector checker
An online XPath tester helps scrapers, QA engineers, and automation authors confirm that an expression still matches after a UI change. Paste a sanitized HTML or XML sample, try XPath or CSS, and inspect matched nodes before you commit Playwright, Selenium, Cypress, or BeautifulSoup code.
Scrapers, browser automation, and XML integrations depend on selectors that keep matching after UI changes. Absolute paths that start at /html/body/... look precise in a one-off dump and then break when a design system wraps content in an extra div. Relative expressions that anchor on stable attributes (id, data-testid, aria-label) survive refactors better.
CSS selectors are usually the better default for modern browser automation. Prefer role- and text-based Playwright locators when accessibility trees are rich. Fall back to CSS when you need attribute equals, nth-child patterns, or shadow-DOM piercing strategies that your framework documents.
XPath 1.0 versus 2.0 matters: many browser engines expose only XPath 1.0. Functions that work in XML editors (tokenize, matches with flags) may fail in Chrome or Firefox. Confirm the engine your scraper uses before you rely on advanced functions.
HTML parsers often lowercase tag names and may rewrite void elements. XML samples keep case and namespaces. Namespaced XML needs prefix registration in the XPath context; otherwise expressions that look correct return empty node sets.
Common failure modes include matching the wrong duplicate class, selecting a hidden template node, and writing selectors that match in a static HTML export but not in a hydrated SPA. Re-test after JavaScript has rendered the final DOM when that is what production serves.
Flaky e2e suites often hide timing issues behind "selector not found" errors. A local tester proves whether the expression is wrong or the page simply had not finished rendering when the test ran. Pair selector checks with explicit waits in the framework, not longer blind sleeps alone.
When should you use an online selector tester? During test authoring, while debugging a flaky e2e suite, and when validating scraper rules against a sanitized HTML fixture. Prefer fixtures that strip cookies and personal data.
Privacy note: DevPipe runs selector evaluation in your browser. Paste sanitized snippets when the markup includes staging URLs, feature flags, or customer-identifying text. Keep production HTML exports off third-party paste sites.
Reference Guide
QA tool - all processing runs locally in your browser. No data is sent to a server.
Operation: xpath-test
Paste input, click Run, and copy the result. For two-input tools, fill both fields before running.
Example Input
<book><title>DevPipe</title></book>
Example Secondary Input
title
A sample loads automatically when you open this tool. Use Load Sample to reset it.
