#  CSS Selector &amp; XPath Tester

 Test [CSS selectors](https://scrapfly.io/blog/posts/css-selector-cheatsheet) and [XPath expressions](https://scrapfly.io/blog/posts/xpath-cheatsheet) on HTML in real-time. See matched elements instantly, generate code for Python/JavaScript, and validate your selectors.

 

### Example HTML Templates

 

 

    

 

  Matches: 0 

 

  HTML Input 

  

 



 

 

  Matched Results 

 

 

 

 

 

### Actions

     

 

 

### From a Working Selector to a Working Scraper

 A selector that matches here still has to survive the real page: markup that only appears after JavaScript runs, class names that rotate on every deploy, and a layout that differs per country. That is where most selector-based scrapers break, and it is not something a tester can catch.

 The [Extraction API](https://scrapfly.io/products/extraction-api) takes the same job from the other end: give it an [extraction template](https://scrapfly.io/docs/extraction-api/rules-and-template) of CSS or XPath rules and it returns structured JSON, or skip the rules entirely and describe the fields in plain language with an [LLM prompt](https://scrapfly.io/docs/extraction-api/llm-prompt) or a predefined product/article/review model. Pair it with the [Web Scraping API](https://scrapfly.io/products/web-scraping-api) when the DOM you are targeting only exists after a browser render.

 [  Turn selectors into structured data ](https://scrapfly.io/products/extraction-api)

1,000 free API credits, no credit card required.

 

 

## Learn Parsing

 [ Introduction to xpath in the context of web-scraping. How to extract data from HTML documents using xpath, best practices and available tools.

 

 

 ](https://scrapfly.io/blog/posts/parsing-html-with-xpath "Parsing HTML with Xpath") 

 [ Introduction to using CSS selectors to parse web-scraped content. Best practices, available tools and common challenges by interactive examples.

 

 

 ](https://scrapfly.io/blog/posts/parsing-html-with-css "Parsing HTML with CSS Selectors") 

 [ When it comes to web scraping, we're generally interested in two main steps: collecting raw data (such as HTML documents) and parsing this data into something we can digest in our business logic

 

 

 ](https://scrapfly.io/blog/posts/web-scraping-with-python-beautifulsoup "Web Scraping with Python and BeautifulSoup")