diff --git a/skyvern/webeye/scraper/domUtils.js b/skyvern/webeye/scraper/domUtils.js index c2d8e94e..08ed0df7 100644 --- a/skyvern/webeye/scraper/domUtils.js +++ b/skyvern/webeye/scraper/domUtils.js @@ -232,7 +232,18 @@ function isElementVisible(element) { } if (!isElementStyleVisibilityVisible(element, style)) return false; const rect = element.getBoundingClientRect(); - return rect.width > 0 && rect.height > 0; + if (rect.width <= 0 || rect.height <= 0) { + return false; + } + + // if the center point of the element is not in the page, we tag it as an interactable element + const center_x = (rect.left + rect.width) / 2; + const center_y = (rect.top + rect.height) / 2; + if (center_x < 0 || center_y < 0) { + return false; + } + + return true; } function isHiddenOrDisabled(element) { @@ -894,14 +905,19 @@ function buildTreeFromBody() { }); }; - // some elements without children should be removed out, such as