XPath Builder
Choose an element, add attribute or text conditions, and chain descendant steps together to build an XPath expression visually.
Element
Generated XPath
//*
How it works
XPath locates nodes in an XML or HTML document using a path syntax: //div[@class="card"] selects any div anywhere in the document with a matching classattribute. This builder assembles that syntax from plain fields — element name, attribute conditions, text conditions, and position — so you don't need to remember the exact predicate syntax.
Add another step to descend further into the tree, either as any descendant (//) or a direct child (/). Want to test an XPath against real markup instead? Use the XPath Tester.
Examples
Element with a class
Any div with a specific class.
//div[@class="card"]
Link containing text
An anchor whose text contains a word.
//a[contains(text(), "Sign up")]
Nth item
The third list item.
//li[3]