Skip to content

[python] provide element locator in the error when element is invisible #3917

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

Closed
php-coder opened this issue Apr 26, 2017 · 7 comments
Closed
Labels
C-dotnet .NET Bindings C-java Java Bindings C-nodejs JavaScript Bindings C-py Python Bindings C-rb Ruby Bindings

Comments

@php-coder
Copy link

When we're trying to interact with invisible element from Python library we got an exception with the following message: You may only interact with visible elements. When this message is showing to user it doesn't help him to debug this situation because it miss the information about element itself.

I'm suggesting to include element locator in the error message, for example: Element id=my-bth is invisible. You may only interact with visible elements.

(I was initially reported this to the Selenium2Library (https://github.com/robotframework/Selenium2Library/issues/769) but author has said that this is Selenium issue.)

@aneeshchandy
Copy link

Which browser are you using? If it is htmlunit driver, then you may want to file the bug here: https://github.com/SeleniumHQ/htmlunit-driver/issues.

@p0deje
Copy link
Member

p0deje commented Jun 8, 2017

Isn't stacktrace enough to point to the element in code that is not visible?

I'm personally inclined to keep it as is, especially since it's rather easy to extend error message in frameworks (at least with Ruby), but let's hear from other committers.

@p0deje p0deje added C-dotnet .NET Bindings C-java Java Bindings C-nodejs JavaScript Bindings C-py Python Bindings C-rb Ruby Bindings labels Jun 8, 2017
@php-coder
Copy link
Author

Which browser are you using? If it is htmlunit driver, then you may want to file the bug here:

Yes, it's htmlunit and I'm going to create issue in their bug tracker as you've suggested. Thanks!

@p0deje
Copy link
Member

p0deje commented Jun 8, 2017

Yes, it's htmlunit and I'm going to create issue in their bug tracker as you've suggested. Thanks!

If you think this should no longer be an bug in Selenium, please close this issue.

@php-coder
Copy link
Author

Isn't stacktrace enough to point to the element in code that is not visible?

I'm using RobotFramework with a plugin for Selenium and the only way to see this stacktrace is to enable debug level. Also I'm running tests on TravisCI and when test fails I couldn't get the report at all. A minor improvement that I'm asking makes debugging process much easier.

@p0deje
Copy link
Member

p0deje commented Jun 8, 2017

A minor improvement that I'm asking makes debugging process much easier.

I'm not against that, however there are complications that are needed to be taken into account. For example, if we take id from element, what should we do for elements that have no id?

@php-coder
Copy link
Author

For example, if we take id from element, what should we do for elements that have no id?

It's a good question. I suspect that it will be hard to construct something like a full path to the element (/html/body/div/ul/li[3]/span) in that case. In this case, an error message can be the same as now (without any details).

@lock lock bot locked and limited conversation to collaborators Aug 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C-dotnet .NET Bindings C-java Java Bindings C-nodejs JavaScript Bindings C-py Python Bindings C-rb Ruby Bindings
Projects
None yet
Development

No branches or pull requests

3 participants