From 2556d04e70c37e0e12a4dd3392dd4ae81e20907b Mon Sep 17 00:00:00 2001 From: LawyZheng Date: Thu, 14 Aug 2025 15:04:15 +0800 Subject: [PATCH] fix scraping edge case (#3186) --- skyvern/webeye/scraper/domUtils.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/skyvern/webeye/scraper/domUtils.js b/skyvern/webeye/scraper/domUtils.js index 1d70b4c6..42236a43 100644 --- a/skyvern/webeye/scraper/domUtils.js +++ b/skyvern/webeye/scraper/domUtils.js @@ -115,7 +115,7 @@ class DomUtils { } // add cache to optimize performance - static getVisibleClientRect(element, testChildren) { + static getVisibleClientRect(element, testChildren = false) { // check cache const cacheKey = `${testChildren}`; if (DomUtils.visibleClientRectCache.has(element)) { @@ -128,7 +128,6 @@ class DomUtils { // Note: this call will be expensive if we modify the DOM in between calls. let clientRect; - if (testChildren == null) testChildren = false; const clientRects = (() => { const result = []; for (clientRect of element.getClientRects()) { @@ -1793,7 +1792,7 @@ function drawBoundingBoxes(elements) { DomUtils.clearVisibleClientRectCache(); elements.forEach((element) => { const ele = getDOMElementBySkyvenElement(element); - element.rect = DomUtils.getVisibleClientRect(ele, true); + element.rect = ele ? DomUtils.getVisibleClientRect(ele, true) : null; }); var groups = groupElementsVisually(elements); var hintMarkers = createHintMarkersForGroups(groups);