Open Vaibhavsahu2810 opened 2 weeks ago
Once this is fixed, the next step would be to provide more information along with the error so that the user can easily figure out where this error is coming from. In its current state, the error itself does not tell anything about its origin and which command/selector went wrong.
@garg3133 is this okay now, I have made all the changes that are needed Thanks!
Description
This pull request addresses issue #4223. The suppressNotFoundErrors property in the new Element API previously suppressed all errors encountered by the WebDriver, including errors like InvalidSelectorError. This behavior was unintended, as suppressNotFoundErrors should ideally only suppress NoSuchElementError.
Changes Made
Updated scoped-element.js to catch and handle NoSuchElementError specifically when suppressNotFoundErrors is enabled. Modified the logic to allow other errors, like InvalidSelectorError, to propagate as expected.
Steps to Reproduce the Issue
Use an invalid selector in a test command: await browser.element.find({ selector: '@something', suppressNotFoundErrors: true }); Observe that InvalidSelectorError is no longer suppressed and propagates as intended.
Proof of Work
Terminal Output The attached screenshot shows the updated terminal output, where an InvalidSelectorError is correctly thrown when an invalid selector is provided.
Unit Test A unit test was added to ecosia.js to validate this behavior. The test checks that an invalid selector throws InvalidSelectorError instead of suppressing it.
Thanks in advance for your contribution. Please follow the below steps in submitting a pull request, as it will help us with reviewing it quicker.
examples/tests
directory of the project) and running them.ecosia.js
andduckDuckGo.js
are good examples to work with.features/my-new-feature
orissue/123-my-bugfix
);