From d814535dc6f13d22d8f33ce443ed0c9c02374238 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Sun, 7 May 2023 13:10:56 +0200 Subject: [PATCH] Element scraper - wrap offset detection in try/catch --- changedetectionio/res/xpath_element_scraper.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/changedetectionio/res/xpath_element_scraper.js b/changedetectionio/res/xpath_element_scraper.js index e363d2a1..27a54c2c 100644 --- a/changedetectionio/res/xpath_element_scraper.js +++ b/changedetectionio/res/xpath_element_scraper.js @@ -8,8 +8,15 @@ // Some pages like https://www.londonstockexchange.com/stock/NCCL/ncondezi-energy-limited/analysis // will automatically force a scroll somewhere, so include the position offset // Lets hope the position doesnt change while we iterate the bbox's, but this is better than nothing +var scroll_y = 0; +try { + scroll_y = +document.documentElement.scrollTop || document.body.scrollTop +} catch (e) { + console.log(e); +} + + -var scroll_y=+document.documentElement.scrollTop || document.body.scrollTop // Include the getXpath script directly, easier than fetching function getxpath(e) {