From 09e6624afd3cc6f90498da53025a2dd9b5192152 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Thu, 8 Dec 2022 20:08:41 +0100 Subject: [PATCH] VisualSelector - Exclude items that are not interactable or visible --- changedetectionio/res/xpath_element_scraper.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/changedetectionio/res/xpath_element_scraper.js b/changedetectionio/res/xpath_element_scraper.js index 193453c7..db76652b 100644 --- a/changedetectionio/res/xpath_element_scraper.js +++ b/changedetectionio/res/xpath_element_scraper.js @@ -81,6 +81,14 @@ var bbox; for (var i = 0; i < elements.length; i++) { bbox = elements[i].getBoundingClientRect(); + // Exclude items that are not interactable or visible + if(elements[i].style.opacity === "0") { + continue + } + if(elements[i].style.display === "none" || elements[i].style.pointerEvents === "none" ) { + continue + } + // Forget really small ones if (bbox['width'] < 10 && bbox['height'] < 10) { continue;