From 4b1cfd7bd3413c3faa9d29fe6eeda67c188ec964 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Mon, 7 Oct 2024 16:11:27 +0200 Subject: [PATCH] Stock/not-in-stock scraper - slight reliability improvement --- .../content_fetchers/res/stock-not-in-stock.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/changedetectionio/content_fetchers/res/stock-not-in-stock.js b/changedetectionio/content_fetchers/res/stock-not-in-stock.js index df33fbe6..373c669e 100644 --- a/changedetectionio/content_fetchers/res/stock-not-in-stock.js +++ b/changedetectionio/content_fetchers/res/stock-not-in-stock.js @@ -154,10 +154,14 @@ function isItemInStock() { } elementText = ""; - if (element.tagName.toLowerCase() === "input") { - elementText = element.value.toLowerCase().trim(); - } else { - elementText = getElementBaseText(element); + try { + if (element.tagName.toLowerCase() === "input") { + elementText = element.value.toLowerCase().trim(); + } else { + elementText = getElementBaseText(element); + } + } catch (e) { + console.warn('stock-not-in-stock.js scraper - handling element for gettext failed', e); } if (elementText.length) {