Block DOM Removals
Last updated
Type: block_dom_removals
This action will prevent the page from removing items from the page. This is useful if you are trying to scrape data from a JavaScript-based web application that removes items from the page when they are out of view, which can make grabbing data difficult.
Using this action will block DOM removals for the rest of the browser request.
block_dom_removal actionPut this action first, before any scrolling. It only protects what happens after it runs.
Use it if you scroll a long list and only the last few rows end up in your capture.
The usual pattern is block_dom_removals, then scroll, then a capture action.
Expect a larger DOM since nothing gets cleared.
See universal parameters.
Block DOM removals for the current browser request
"actions": [
{
"type": "block_dom_removals"
}
]Use it when a site removes elements from the page as you scroll past them. This is common in long feeds and data grids. Blocking removals keeps every loaded row on the page.
Scroll the page yourself with DevTools open and watch the Elements panel. If earlier rows disappear as new ones load, the site is recycling elements, and you need this action.
Yes. Once it runs, removals are blocked for all subsequent actions. Put it early because it can't restore elements the page has already removed.
No. It only takes the universal parameters: type, continue_on_fail, and custom_id. Add "type": "block_dom_removals" to your actions array and nothing else.
Last updated