Cette page n’est pas encore traduite en français : elle s’affiche en anglais.

XPath Tester — Evaluate XPath on XML & HTML

Paste XML or HTML, type an XPath expression and see the matching nodes instantly — with their text, attributes and an exact path you can copy. Great for scrapers, XSLT, Selenium and config files.

Mis à jour le
Result

Vos données ne quittent jamais votre ordinateur. Tout le traitement se fait localement dans votre navigateur.

Comment utiliser : XPath Tester

  1. Paste XML or HTML (switch the mode for HTML pages), or load the sample.
  2. Type an XPath expression — results update as you type.
  3. Each match shows its exact path, attributes and content; click a path to use it as the expression.
  4. Try the example chips to learn common patterns.

XPath in a nutshell

ExpressionSelects
/catalog/bookbook elements that are direct children of the root catalog
//titleevery title element anywhere
//book[@id='bk102']books whose id attribute equals bk102
//book[price > 30]/titletitles of books priced above 30
//book[1] / //book[last()]the first / last book in each parent
//a[contains(@href, 'docs')]links whose URL contains “docs”
//li[normalize-space()='Home']list items whose trimmed text is exactly Home
count(//book)a number instead of nodes
//title/text()the text nodes themselves

Namespaces

In XML with a default namespace (xmlns="…"), //book matches nothing because the elements are in that namespace. Declared prefixes are picked up automatically, and the default namespace is available as the prefix d: — write //d:book. Alternatively use //*[local-name()='book'].

HTML mode

HTML is parsed the way a browser parses it, so missing closing tags are repaired and a <tbody> is inserted into tables — the same structure Selenium, Playwright and scrapers see. The browser’s built-in XPath 1.0 engine is used. Tidy documents first with the XML formatter, or convert them with XML to JSON.

Aussi recherché comme : xpath online, xpath evaluator, test xpath, xpath checker, xml xpath, html xpath, xpath generator.

Outils complémentaires : XPath Tester

  • JSONPath Tester — Type a JSONPath query and instantly see what it selects — with the exact path of each match.
  • Testeur d’expressions régulières — Saisissez un modèle et observez les correspondances s'afficher en temps réel dans votre texte de test.
  • Online HTML Editor — A lightweight code playground: edit HTML, CSS and JavaScript side by side, see the result instantly, read console output and download your page as one HTML file.
  • HTML Formatter — Paste minified or messy markup and get clean, consistently indented HTML — including embedded <style> and <script> blocks.

Questions fréquentes

Which XPath version is supported?
XPath 1.0, the version built into browsers, Selenium, lxml, libxml2 and most scraping tools. XPath 2.0/3.1 functions such as matches() or upper-case() are not available.
Why does my XPath work in the browser but not in my scraper?
Browsers add elements when parsing HTML (for example tbody) and pages often change with JavaScript. Test against the raw HTML your scraper downloads, using HTML mode here.
Is my document uploaded?
No. It is parsed and evaluated in your browser.
Puis-je installer XPath Tester en tant qu’application web et l’utiliser hors ligne ?
Oui. XPath Tester est une application web installable (PWA) : elle s’installe depuis votre navigateur, sans passer par une boutique d’applications. Cliquez sur « Installer l’application » en haut de cette page dans Chrome ou Edge (Windows, macOS, Linux, ChromeOS) ; sur Android, utilisez « Partager » → « Ajouter à l’écran d’accueil » sur iPhone et iPad ; ou « Fichier » → « Ajouter au Dock » dans Safari 17+ sur Mac. L’application s’ouvre alors dans sa propre fenêtre avec sa propre icône, et comme elle s’exécute entièrement dans votre navigateur, elle continue de fonctionner hors ligne. Firefox sur ordinateur de bureau ne permet pas d’installer d’applications web. Comment fonctionne l’installation.

Outils similaires