HTML DOM CSS Selector & XPath Web Scraper Expression Tester
Test CSS selectors (`div.card > h2.title`) and XPath expressions (`//div[@class='item']/a/@href`) against raw HTML markup. Highlight matched DOM nodes, extract text or attributes, and inspect match counts online.Documentation & FAQs ↓
from bs4 import BeautifulSoup
soup = BeautifulSoup(html_content, 'html.parser')
matches = soup.select(".product-card .price")
results = [el.get_text(strip=True) for el in matches]const data = await page.$$eval('.product-card .price', els => els.map(e => e.textContent.trim()));Step-by-Step Instructions
4 Steps to CompletionPaste target HTML source code (or a sample DOM snippet) into the HTML document pane.
Choose selector type: CSS Selector or XPath Expression.
Type your expression (e.g., article.post a.read-more or //div[@class='product']//span[@class='price']/text()).
Inspect matched node counts, extracted attributes, text payloads, and copy ready-to-run scraper code.
Practical Use Cases & Real-World Scenarios
Dual CSS & XPath Parsing Engine
Test modern CSS selectors (:nth-child, [attr*=val]) and complex XPath 1.0 axis expressions (//ancestor::div).
Live DOM Match Highlighting
Displays total matched element counts and visually highlights extracted text content and attributes in real-time.
Attribute & Text Extractor
Extract specific HTML attributes (href, src, data-*) or inner text content formatted as JSON or raw arrays.
Code Snippet Exporter
Exports tested selectors ready for Python (BeautifulSoup, Scrapy, Playwright), Node.js (Cheerio, Puppeteer), and Selenium.
Frequently Asked Questions
What is the difference between CSS selectors and XPath in web scraping?↓
Why did my XPath or CSS selector fail on a live site when it worked in DevTools?↓
How do you select an element by its text content using XPath?↓
How do you select the parent element of a matched node?↓
What are common selector anti-patterns that break scrapers?↓
10 Best Web Scraping Tools for Data Extraction in 2026
Dive deeper into the foundational technical concepts behind this tool on our editorial blog. Includes comprehensive hardware benchmarks, case studies, and best practices.
Found this tool helpful? Share it with colleagues & friends:
100% free, private in-browser utility with zero server uploads.
