XPath & CSS Selector Builder
Build XPath and CSS selectors in real-time by filling in tag, class, ID, and attributes.
Results update in real-time as you type.
Examples of use
- Build a locator for a button with class "btn-primary" and id "submit"
- Generate an XPath for elements with a custom data-testid attribute
- Create a CSS selector for a form input inside a specific container
When to use this tool?
- When writing Selenium, Playwright, or Cypress test locators
- When building XPath or CSS selectors for web scraping
- When debugging element selection issues in test automation
Frequently asked questions
- What is the difference between XPath and CSS selectors?
- XPath can traverse up the DOM tree (find parent elements) and supports text-based matching. CSS selectors are generally faster and more concise for simple element selection. Both are widely used in test automation.
- Which should I use for test automation?
- CSS selectors are preferred for speed and simplicity. Use XPath when you need to navigate parent elements, match by text content, or when CSS selectors cannot uniquely identify an element.