Skip to content

Automate browser based workflows with AI

fix scrolling makes element invisible (#881)

LawyZheng9cd925befaff
diff --git a/skyvern/webeye/scraper/domUtils.js b/skyvern/webeye/scraper/domUtils.js
index 96fd00b7f..1caa0b6cb 100644
--- a/skyvern/webeye/scraper/domUtils.js
+++ b/skyvern/webeye/scraper/domUtils.js
@@ -248,12 +248,16 @@ function isElementVisible(element) {
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) {
+ // if the center point of the element is not in the page, we tag it as an non-interactable element
+ // FIXME: sometimes there could be an overflow element blocking the default scrolling, making Y coordinate be wrong. So we currently only check for X
+ const center_x = (rect.left + rect.width) / 2 + window.scrollX;
+ if (center_x < 0) {
return false;
}
+ // const center_y = (rect.top + rect.height) / 2 + window.scrollY;
+ // if (center_x < 0 || center_y < 0) {
+ // return false;
+ // }
return true;
}