Capture DOM
Type: capture_dom
This action will capture and return the site's raw DOM, which you can then extract data from on your end.
For common AI scenarios, you may find that this returns too much data, so we have provided a generate_simplified_dom , an action that distils the DOM to only the important elements.
Parameters
See universal parameters.
Usage
Capture the raw DOM of the current page
"actions": [
{
"type": "capture_dom"
}
]Example Output
FAQs
When do I use the capture_dom action?
Use it when you want to parse the page yourself with a library like BeautifulSoup, or when you need scripts, attributes and link query strings that the simplified and Markdown outputs remove. See our guide to scraping tables with Python.
What does capture_dom action return?
It returns the page's raw DOM as the browser rendered it, including scripts, styles and every attribute. This is the page after JavaScript has run, not the original server HTML.
Why is content missing from my capture_dom output?
The action probably ran before the page finished loading. Add a wait action with a selector for the content you're expecting, so Gaffa captures the page once it's there.
When should I use generate_simplified_dom instead of capture_dom?
Use generate_simplified_dom whenever the output goes to an LLM, or you're looking for selectors. It keeps the page structure but removes the scripts and styling that make raw DOM so large. See our guide to simplifying a webpage DOM.
Why is my capture_dom output so big?
Raw DOM includes all scripts and styles on the page. Use generate_simplified_dom to strip those out, or capture_element with a selector to capture only the part you need.
How do I capture only part of the page with capture_dom action?
Use capture_element with a selector instead. It gives you the same raw HTML, but only for the element you point it at.
Last updated