From f156cc2fca2ee9a8f57586d6fdf29cca3a37f25f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0nan=C3=A7=20G=C3=BCm=C3=BC=C5=9F?= Date: Fri, 4 Oct 2024 15:20:03 -0400 Subject: [PATCH] Enhance waitForSelector js error message waitForSelector may result in a confusing error message: selector did not resolve to any element We're now explaining which selector didn't resolve to an element. --- common/js/injected_script.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/common/js/injected_script.js b/common/js/injected_script.js index a37093abf..7f2c0b88b 100644 --- a/common/js/injected_script.js +++ b/common/js/injected_script.js @@ -984,7 +984,6 @@ class InjectedScript { waitForSelector(selector, root, strict, state, polling, timeout, ...args) { let lastElement; - let previewNode = this.previewNode; const predicate = () => { const elements = this.querySelectorAll(selector, root || document); const element = elements[0]; @@ -993,7 +992,7 @@ class InjectedScript { if (lastElement !== element) { lastElement = element; if (!element) { - console.log(` selector did not resolve to any element`); + console.log(` ${selector} did not match any elements`); } else { if (elements.length > 1) { if (strict) {