DevToolBoxGRATIS
Blogg

XPath-tester Online — Evaluer XPath-uttrykk

Test XPath-uttrykk mot XML-dataene dine i sanntid. Gratis, ingen registrering nødvendig.

Common XPath Examples:

𝕏 Twitterin LinkedIn

Vurder dette verktøyet

3.9 / 5 · 174 vurderinger

Hold deg oppdatert

Få ukentlige dev-tips og nye verktøy.

Ingen spam. Avslutt når som helst.

Enjoy these free tools?

Buy Me a Coffee

How to Use XPath Tester

  1. Paste your XML document into the XML Input field
  2. Enter an XPath expression in the XPath Query field (e.g., //book/title)
  3. Click 'Evaluate XPath' to run the query against your XML
  4. View matching nodes, their values, and the total match count in the results panel
  5. Try the built-in XPath examples for common query patterns

Common Use Cases

  • Testing XPath expressions for web scraping and data extraction
  • Debugging XSLT transformations by validating XPath selectors
  • Querying XML configuration files (pom.xml, web.xml, AndroidManifest.xml)
  • Learning XPath syntax with real-time feedback on XML documents
  • Validating XPath locators for Selenium or Playwright test automation

Frequently Asked Questions

What is XPath and how does it work?
XPath (XML Path Language) is a query language for selecting nodes from XML documents. It uses path-like expressions to navigate the XML tree structure. For example, //book selects all book elements, and //book[@price>30] selects books with a price attribute greater than 30.
What is the difference between XPath and CSS selectors?
XPath can navigate both forward and backward in the XML/HTML tree and supports complex conditions, while CSS selectors only navigate downward. XPath is more powerful for XML querying, while CSS selectors are simpler and faster for HTML styling. XPath supports text content matching; CSS selectors do not.
How do I select elements by attribute in XPath?
Use the @ symbol to select attributes. For example: //div[@class='main'] selects div elements with class 'main', //input[@type='text'] selects text inputs, and //*[@id='header'] selects any element with id 'header'.
What is the difference between / and // in XPath?
A single slash (/) selects from the root or current node's direct children only. Double slash (//) selects matching nodes anywhere in the document regardless of depth. For example, /bookstore/book selects direct children, while //book selects all book elements at any level.
Can I use XPath to query HTML documents?
Yes. XPath works on both XML and well-formed HTML (XHTML). Most browsers support XPath queries via document.evaluate(). This tool accepts any valid XML input, including XHTML documents.
How do I test XPath expressions for Selenium?
Paste your page's HTML source into the XML Input field, then test your XPath locator expressions. This helps you validate selectors before using them in Selenium's find_element(By.XPATH, '...') or Playwright's page.locator('xpath=...') calls.
What XPath functions are supported?
This tool supports standard XPath 1.0 functions including: text(), contains(), starts-with(), string-length(), count(), sum(), position(), last(), not(), and boolean operators (and, or). These work for filtering and matching nodes.

💬 User Feedback

Have suggestions or found a bug? Leave a message and we'll get back to you.
0/2000