XPath Playground
Test your XPath expressions against sample DOMs. Click elements to generate suggestions, or type your own expressions.
DOM Preview
A simple login form with email, password, and remember me checkbox
Click elements to generate XPath
Press Ctrl+Enter to evaluate
No matches found
Try adjusting your XPath expression
Quick Tips
- • Use
//for relative paths (recommended) - • Prefer
@data-testidfor stability - • Use
contains()for partial matching - • Press Ctrl+Enter to evaluate
Common Patterns
- •
//*[@id='value'] - •
//button[text()='Submit'] - •
//input[@type='email'] - •
//*[contains(@class,'btn')]
Robustness Guide
- Stable - data-testid, aria-*, id
- Medium - text, class, href
- Fragile - position, absolute path