Skip to content
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

Throwing TimeoutError when chained .find() command fails #4078

Closed
dikwickley opened this issue Mar 1, 2024 · 18 comments · Fixed by #4193
Closed

Throwing TimeoutError when chained .find() command fails #4078

dikwickley opened this issue Mar 1, 2024 · 18 comments · Fixed by #4193

Comments

@dikwickley
Copy link
Contributor

dikwickley commented Mar 1, 2024

Description of the bug/issue

When .find() command is chained and it fails to resolve any element, it throws an TimeoutError instead of NoSuchElementError.

image

Branched off from issue: #3991
Reference comment: #3991 (comment)

Sample test

Just use browser.element.find('.invalid_selector'); in any Nightwatch example test and run the test.

Potential solution

We'd probably need to check if the error thrown by the .find() command is a timeout error and if so, change the error name accordingly.

After the fix, instead of a timeout error, we should get an error in the following format when Nightwatch is unable to find an element:

image

Nightwatch.js Version

3.3.7

@Honey2339
Copy link

Hey i would like to know that are you working on this?

@dikwickley
Copy link
Contributor Author

Hey @Honey2339 I am not working on this currently, you can take this up.

@piyushmishra1416
Copy link

Hello @dikwickley, can you please explain why I am encountering the same error twice? Will you please explain the if there is any reason behind this?
Screenshot 2024-03-03 at 12 20 52 AM

@Ayush-Vish
Copy link
Contributor

@garg3133 I have raised PR for #4084 and also I have explained the solution.

@vidhvath28
Copy link

vidhvath28 commented Mar 6, 2024

hey @dikwickley I am interested in working on issues, I have set up locally for now. I kindly request you to assign me this issue.

@vidhvath28
Copy link

Screenshot 2024-03-06 100758

started working on the issue @dikwickley @garg3133

@vidhvath28
Copy link

vidhvath28 commented Mar 6, 2024

Screenshot 2024-03-06 101840
Test cases have been updated with sample test, please give your feedback on the code .

@vidhvath28
Copy link

Screenshot 2024-03-06 102435
Requesting you to allow my pull request for #4084

@garg3133
Copy link
Member

garg3133 commented Mar 6, 2024

The goal for this issue is to get an error in the following format when Nightwatch is unable to find an element, instead of a timeout error.

image

It's a very simple fix but right now there are no PRs which achieves this.

@Ayush-Vish
Copy link
Contributor

Ayush-Vish commented Mar 6, 2024

@garg3133 Please Review my PR. I have Added output in the PR Itself.
#4084

@garg3133
Copy link
Member

garg3133 commented Mar 6, 2024

@Ayush-Vish I have, but as you can see, the format of error message in your PR is not same as what I shared above (no Try fixing by part in the error message, which should be appended automatically by Nightwatch for NoSuchElementError).

@Ayush-Vish
Copy link
Contributor

NoSuchElementError

Ok I'll fix it as Quickly as Possible thanks.

@Honey2339
Copy link

@garg3133 I've just pushed the changes for the fix described above. Please review the PR at your earliest convenience.

@AritraLeo
Copy link
Contributor

@garg3133 @dikwickley
browser.element.find('.invalid_selector');
on which test file shall I use it becuase I was using ecosia and duckDuck.js files to test the code for isPresent() issue (idk if I am right or wrong) but I received an error -
at - .navigateTo('https://duckduckgo.com')
please help me out a little bit in understanding the codebase I think once I get a good understanding I'll be able to contribute more and more! Thanks

@Ayush-Vish
Copy link
Contributor

Ayush-Vish commented Mar 7, 2024

@garg3133 I have Fixed the error now and it is showing Required Error output.

2024-03-07.23-13-59.mp4

#4102

@Ayush-Vish
Copy link
Contributor

@garg3133 Please Review My PR, I have done all the required changes.

@HrxSrv
Copy link

HrxSrv commented Mar 12, 2024

Supposed Fix PR #4122, please have a look @garg3133 .

@Visbhavesh
Copy link

hey assign these issue to me and I will resolve these

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment