-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suppressing error for further chained .find()
commands
#4119
Suppressing error for further chained .find()
commands
#4119
Conversation
Status
|
@garg3133 is this a good solution to suppress the error for chained find commands |
.find()
commands
Can you add a test to show that this works as anticipated |
Hey, Have you tried the solution on some test cases ? In my case it still didn't suppress the further errors. [Testing Chain Commands] Test Suite Running sample test for debug:
FAILED: 1 errors (5.089s) |
hey @chikara1608 try it for such an example browser.element('.invalid_selector').find('.some_other_selector') |
hey @AutomatedTester how can I add such test case that checks for the errors thrown. |
ohh my bad! So if I got this right, the solution would basically suppress the error thrown by find in case there was an error in the command before it right ? |
Yes correct |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The solution looks good but could be converted to a single if statement:
if (parentElement?.webElement && await parentElement.webElement === null) {
return null;
}
For tests, we could probably check if the HTTP request for the subsequent find
commands goes through (they shouldn't), or if the error messages are logged for all the chained find
commands or just the first command. You could try thinking in these lines.
Fixes: #4079
Fixes: dikwickley/gsoc24#1
Solves the third point from this comment (#3991 (comment))
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.
features/my-new-feature
orissue/123-my-bugfix
);