From 3d390b6ea46a426e65c3b4c1c55b0c90e1c10762 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Wed, 21 Feb 2024 11:00:35 +0100 Subject: [PATCH] BrowserSteps UI - Avoid selecting very large elements that are likely to be the page wrapper --- changedetectionio/static/js/browser-steps.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/changedetectionio/static/js/browser-steps.js b/changedetectionio/static/js/browser-steps.js index 90198d32..7c9c38d8 100644 --- a/changedetectionio/static/js/browser-steps.js +++ b/changedetectionio/static/js/browser-steps.js @@ -160,6 +160,12 @@ $(document).ready(function () { e.offsetX > item.left * y_scale && e.offsetX < item.left * y_scale + item.width * y_scale ) { + // Ignore really large ones, because we are scraping 'div' also from xpath_element_scraper but + // that div or whatever could be some wrapper and would generally make you select the whole page + if (item.width > 800 && item.height > 400) { + return + } + // There could be many elements here, record them all and then we'll find out which is the most 'useful' // (input, textarea, button, A etc) if (item.width < xpath_data['browser_width']) {