From 62591eff8508112fffbc064ec27befad8f717892 Mon Sep 17 00:00:00 2001 From: Shuchang Zheng Date: Thu, 27 Mar 2025 00:26:41 -0700 Subject: [PATCH] check null for document.body and document.documentElement inside function isWindowScrollable (#2028) --- skyvern/webeye/scraper/domUtils.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/skyvern/webeye/scraper/domUtils.js b/skyvern/webeye/scraper/domUtils.js index 4ba4e437..c2729600 100644 --- a/skyvern/webeye/scraper/domUtils.js +++ b/skyvern/webeye/scraper/domUtils.js @@ -1993,11 +1993,15 @@ async function scrollToNextPage( } function isWindowScrollable() { + const documentBody = document.body; + const documentElement = document.documentElement; + if (!documentBody || !documentElement) { + return false; + } + // Check if the body's overflow style is set to hidden - const bodyOverflow = getElementComputedStyle(document.body)?.overflow; - const htmlOverflow = getElementComputedStyle( - document.documentElement, - )?.overflow; + const bodyOverflow = getElementComputedStyle(documentBody)?.overflow; + const htmlOverflow = getElementComputedStyle(documentElement)?.overflow; // Check if the document height is greater than the window height const isScrollable =