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

Show command usage location in new Element API errors. #4194

Open
garg3133 opened this issue Apr 19, 2024 · 4 comments
Open

Show command usage location in new Element API errors. #4194

garg3133 opened this issue Apr 19, 2024 · 4 comments

Comments

@garg3133
Copy link
Member

garg3133 commented Apr 19, 2024

Description of the bug/issue

The errors coming from the new Element API do not pinpoint the exact location where the command that led to the error was used in the test case.

This is in contrast with the old API which used to show the exact location of command usage in the error stack.

For e.g., if we use await browser.findElement('.invalid_selector');, we'd get the following error (the line where the findElement command is used is clearly highlighted):

image

On the other hand, when using the new Element API (await browser.element.find('.invalid_selector');), we get the following error (the highlight does not show where the command was actually used):

image

Steps to reproduce

Run await browser.element.find('.invalid_selector'); in any test.

Nightwatch.js Version

latest

@Ayush-Vish
Copy link
Contributor

I will work on this issue after a week. Looks interesting!

@AritraLeo
Copy link
Contributor

Hey @garg3133 I went through the description I think what you want is a custom error handler to catch these errors and return accordingly as the New Element API isn't returning an apt error message. Please let me know if I am wrong.

@garg3133
Copy link
Member Author

@AritraLeo The error "message" is fine here, just the "Error location" section is pointing to the wrong location.

For this, we'd need to see how it happens in the old element API and then implement something similar in the new API.

@AritraLeo
Copy link
Contributor

@AritraLeo The error "message" is fine here, just the "Error location" section is pointing to the wrong location.

For this, we'd need to see how it happens in the old element API and then implement something similar in the new API.

Ohk I get your point so to get the job done exploring how err is thrown in old element api is required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants