Free CSS Selector Tester
Test and validate CSS selectors against HTML. Preview matching elements and attribute values, check selector syntax, and see a Playwright locator example.
Loading tool…
How it works
Paste your HTML
Use the HTML from the page you want to query or load the included example. The tester parses it without running scripts or loading images and frames.
Test a selector
Enter a CSS selector such as table tbody tr or a[href]. The results show matching nodes in document order. Add an attribute name such as href to inspect its value.
Reuse the match
Copy matched values and source snippets as JSON, or use the Playwright locator example as a starting point for your browser automation.
Which CSS syntax is supported?
Selectors use your browser’s querySelectorAll implementation. Classes, IDs, attributes, combinators, and supported pseudo-classes work. Pseudo-elements such as ::before are not DOM elements and cannot be extracted.
Why does a selector differ on a live page?
The pasted HTML has no running JavaScript or live hover and focus state. Shadow roots and iframe documents are outside the query. If content appears only after JavaScript runs, copy the DOM from your browser’s developer tools before testing.
Run your extraction with Playwright.
Connect your own Playwright code to Browser Use and collect data from managed browsers.