diff --git a/skyvern/webeye/scraper/domUtils.js b/skyvern/webeye/scraper/domUtils.js index 6e0a782a..64437cf7 100644 --- a/skyvern/webeye/scraper/domUtils.js +++ b/skyvern/webeye/scraper/domUtils.js @@ -2194,6 +2194,15 @@ function asyncSleepFor(ms) { } async function addIncrementalNodeToMap(parentNode, childrenNode) { + const maxParsedElement = 3000; + if ((await window.globalParsedElementCounter.get()) > maxParsedElement) { + console.warn( + "Too many elements parsed, stopping the observer to parse the elements", + ); + await window.globalParsedElementCounter.add(); + return; + } + // make the dom parser async await waitForNextFrame(); if (window.globalListnerFlag) {