XPath Builder Pro RPA / Selenium ready
Build robust XPaths with a guided manual mode, analyse HTML snippets and validate selectors.
Built by Victor · internal automation helper
Working mode
Quick templates
Use presets for common selectors: buttons, links, inputs and tables.
Step 1 · Element type
Example: link, button, input, etc.
You can use * for very generic selectors, but they are usually less stable.
Step 2 · Element attributes
Examples: id, class, name, href, data-testid...
Tip: prefer stable attributes like data-testid or fixed ids.
Step 3 · Visible text (optional)
Useful when the button or link has a stable label such as "Submit".
Step 4 · Advanced options
Use .// if you already located a parent and want to search inside it.
For example, //button[...][2] is the second matching button.
Step 5 · Generated XPath
Click Generate XPath once you have at least one attribute or text filter.
Copied ✅
Automatic mode · paste element HTML

Paste here the HTML of the element you want to locate. Ideally one node, for example:

<button id="loginBtn" class="btn btn-primary">Sign in</button>

Automatic mode fills the manual form above: tag, attributes and text are detected and an XPath is generated. Then you can go back to Manual mode to tweak the details.

Selector summary
Medium quality

XPath Linter
Code generator

Uses the current generated XPath to build a ready-to-use code snippet.

# Generate an XPath first to see the code sample here.
Live tester (XPath vs HTML snippet)

Paste a small HTML fragment and test your XPath against it. Useful for validating selectors before using them in your bot.

Result preview (first matched node):

                            
All matched nodes:
XPath cheat sheet
  • //tag → search anywhere in the document.
  • .//tag → search under current node only.
  • @attr="value" → exact match.
  • contains(@attr, "val") → partial match.
  • starts-with(@attr, "val") → prefix match.
  • normalize-space(text()) → trim outer spaces.
Examples:
//button[contains(normalize-space(), "Save")]
//table//tr[td[contains(normalize-space(), "PATIENT_NAME")]]