What it means
An interface that represents documents such as HTML and XML as an accessible, editable tree of objects. Scripts can change nodes, so the current DOM may differ from the original HTML response.
DOM contains elements, text and other nodes and their relationships. Selectors and scripts can locate these nodes, read properties, extract text, or observe page changes.
When collecting, you should first determine whether you are parsing the original HTML or the document tree after the browser runs the script. What you see in the developer tools may not necessarily already exist in the source code returned by a normal HTTP request.
Focused check 2026-12-02: Cheerio load normally supplies html/head/body wrappers; setting the third argument to false parses a fragment. These nodes may be parser additions, not evidence that the server returned them verbatim. Distinguish the original response from the parsed tree.
In a scraping task
The price is displayed on the page, but not in the response.
The initial HTML just contains an empty price container, the script then gets the price from the interface and writes it to the node. The browser DOM already has a price, and static HTML parsers still only see empty containers.
<span id="price"></span>
<!-- Page scripts may add text to this node. -->Common misconceptions
- DOM is not another name for an HTML file, it is the object representation of the document in the running environment.
- Seeing that the node exists does not mean that its content has been fully loaded.
References
Organized by Northleaf Studio. The source link retains the original address to facilitate continued reading.
- MDN: Introduction to DOM
Original data · Verified on 2026-11-19
- Playwright: Navigation and page loading
Original data · Verified on 2026-11-19
- Cheerio · Loading Documents
Original sources · Checked 2026-12-02