From bd0ba927a92434c4e2e183b6521836299ee039a8 Mon Sep 17 00:00:00 2001 From: Vaibhav Date: Sat, 9 Nov 2024 01:18:26 +0530 Subject: [PATCH] FIXES #4223: Suppress only NoSuchElementError in suppressNotFoundErrors --- lib/api/web-element/scoped-element.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/api/web-element/scoped-element.js b/lib/api/web-element/scoped-element.js index 8dffc0b8f..91a17d894 100644 --- a/lib/api/web-element/scoped-element.js +++ b/lib/api/web-element/scoped-element.js @@ -180,7 +180,10 @@ class ScopedWebElement { return await this.findElement({parentElement, selector: condition, index, timeout, retryInterval}); } catch (error) { - if (this.suppressNotFoundErrors) { + if ( + this.suppressNotFoundErrors && + error.name === 'NoSuchElementError' + ) { return null; }