nightwatchjs / nightwatch

Integrated end-to-end testing framework written in Node.js and using W3C Webdriver API. Developed at @browserstack
https://nightwatchjs.org
MIT License
11.75k stars 1.3k forks source link

`suppressNotFoundErrors` in new Element API suppress other errors as well. #4223

Open garg3133 opened 1 week ago

garg3133 commented 1 week ago

Description of the bug/issue

suppressNotFoundErrors property in the new Element API should ideally only suppress the NoSuchElementError but instead it suppresses all the errors that the WebDriver encounters and returns while trying to find the element.

For example, it also suppresses the InvalidSelectorError, which is thrown when the selector passed to the find() command is invalid, which could be a human error while writing the test.

Steps to reproduce

In any test, run the following command:

await browser.element.find({selector: '@something', suppressNotFoundErrors: true});

The above command will suppress and not throw any error even though the error is InvalidSelectorError and not NoSuchElementError.

Sample test

No response

Command to run

No response

Verbose Output

No response

Nightwatch Configuration

No response

Nightwatch.js Version

latest

Node Version

No response

Browser

No response

Operating System

No response

Additional Information

No response