XPath Tester (Live XML / HTML)
Type an XPath expression and an XML / HTML document; the tool evaluates and shows matched nodes. Browser-native XPath 1.0 (no XPath 2/3 features). Useful for verifying scrapers, parsers, document transformations.
How to use the XPath Tester (Live XML / HTML)
Paste an XML or HTML document and type an XPath expression. The tool evaluates it and lists the matched nodes — elements, attributes, or a computed value. Use the example buttons to try predicates, attributes, and functions like count().
Testing XPath expressions
XPath navigates XML and HTML documents and turns up everywhere data is pulled from markup — scrapers built on lxml or Scrapy, XSLT transforms, SOAP and config parsing, and Selenium element locators. An expression that uses predicates, axes, and functions is easy to get subtly wrong, returning nothing or the wrong nodes.
This evaluates an XPath 1.0 expression against a pasted XML or HTML document using the native browser engine and shows what it matched — elements, attributes, or a computed value such as count(). Because it is browser-native, it is XPath 1.0 only; 2.0 and 3.0 functions are unavailable. For CSS selectors rather than XPath, the CSS selector tester is the counterpart, and to tidy a document before testing against it, the XML formatter.
Common use cases
- Debug a scraper — see why an lxml or Scrapy XPath returns no nodes.
- Build Selenium locators — verify an XPath before using it as a locator.
- Test predicates — check
[@category='fiction']and positional filters. - Use functions —
count(),text(), andcontains()against a document. - Extract attributes — confirm
//tag/@attrselects the right values.