webscrape.dev

DOM (Document Object Model)

The DOM is the in-memory tree a browser builds from an HTML document and then mutates as scripts run. It is an object graph with an API, not a text format. The distinction that matters most in scraping follows directly: the HTML the server sent is not the DOM the user sees. On a modern site the two can share almost no structure.

A scraper can target three states. The raw response bytes are what an HTTP client receives, before any script has run. The DOM after initial parse is that markup as a tree, with malformed regions repaired and implied elements inserted. The DOM after script execution and hydration settle is what DevTools shows you. Selectors are almost always written against the third state and then run against the first, which is why a selector you verified by right-clicking in the browser fails on the first real request and returns nothing. Nothing errored. The node simply did not exist yet.

Two structures break otherwise correct selectors without any obvious symptom. Shadow DOM encapsulates a component's internal tree behind a boundary that ordinary document-level queries do not cross, so a selector matching a node you can see in the inspector matches nothing from script. Tooling differs here: the Playwright documentation states that "CSS selectors pierce open shadow DOM", while noting separately that "XPath does not pierce shadow roots", so switching selector dialect silently changes what is reachable. Iframes are a harder boundary again, since the embedded document is a separate document, and any content inside one must be addressed through a frame handle rather than found in the parent.

Before committing to browser rendering, run the cheap test: fetch the raw HTML with curl or a plain HTTP client and search it for a value you need. A surprising share of client-rendered pages ship their records in the initial payload anyway, in a JSON blob assigned to a global variable, in a Next.js __NEXT_DATA__ script tag, or in an embedded JSON-LD block. If the data is there, skip the browser and extract from JSON, which is both more stable than selectors and far cheaper. That call is usually the largest single cost difference in a crawl: a plain fetch is a few kilobytes and milliseconds of CPU, while a rendered page in Playwright or Puppeteer is a browser process, hundreds of megabytes of memory and seconds of wall clock. Crawl4AI and similar tools let you try the cheap path first and fall back only where the raw fetch comes up empty. Render by exception, not by policy.

Tools that handle dom (document object model)

4 tools in the webscrape.dev directory are commonly used for dom (document object model) workflows, spanning crawling frameworks. Each is reviewed independently with pricing and editorial assessment.

Playwright

Playwright is an open-source browser automation framework created and maintained by Microsoft. It drives Chromium, Firefox, and WebKit through a single API, with auto-waiting, network interception, and bindings for JavaScript/TypeScript, Python, .NET, and Java. It was built originally for end-to-end testing, but it's now widely used for web scraping because it renders JavaScript-heavy pages and can be scripted to extract data. It also ships an MCP server for driving it from AI agents.

Free
Puppeteer

Puppeteer is an open-source Node.js library maintained by Google's Chrome team. It has a high-level API for controlling Chrome or Firefox over the Chrome DevTools Protocol or WebDriver BiDi and runs headless by default. Teams use it for browser automation tasks like scraping and testing, and for generating screenshots and PDFs of pages. The GitHub repository has 95.3K stars, is Apache-2.0 licensed, and the current published version is 25.3.0.

Free
Beautiful Soup

Beautiful Soup is an open-source Python library for parsing and navigating HTML and XML documents, used to pull structured data out of web pages. Its Pythonic API searches the parse tree with CSS-selector-like find and find_all methods, handles charset and Unicode conversion automatically, and lets you swap parser backends between Python's built-in html.parser, lxml, and html5lib. It only parses documents: it doesn't fetch pages or render JavaScript, so it's usually paired with requests or Scrapy.

Free
Crawl4AI

Crawl4AI is an open-source Python library (Apache 2.0) for crawling and scraping web pages into clean, structured Markdown, built for LLM and AI-agent data pipelines. It supports CSS/XPath-based and LLM-based structured data extraction. Playwright-based browser automation is built in, with session, proxy, cookie, and stealth support plus parallel and adaptive crawling. It installs via pip or runs through Docker with an API gateway; a hosted Crawl4AI Cloud API is in closed beta, with no published pricing.

Free

Browse by category

Crawling Frameworks Self-hosted libraries for building crawlers you run and own, with no per-request pricing.