* for very generic selectors, but they are usually less
stable.
id, class, name,
href, data-testid...
data-testid or fixed ids.
.// if you already located a parent and want to search
inside it.
//button[...][2] is the second matching button.
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.
Uses the current generated XPath to build a ready-to-use code snippet.
# Generate an XPath first to see the code sample here.
Paste a small HTML fragment and test your XPath against it. Useful for validating selectors before using them in your bot.
//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.//button[contains(normalize-space(), "Save")]
//table//tr[td[contains(normalize-space(), "PATIENT_NAME")]]