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

IsNotVisible always waits webdriver.timeouts.implicitlywait milliseconds long #2960

Open
Thrillpool opened this issue Nov 1, 2022 · 1 comment
Labels
can't-fix We don't know how to do this at the moment

Comments

@Thrillpool
Copy link

Thrillpool commented Nov 1, 2022

The implementation of IsNotVisible is effectively !IsVisible. This has an issue, namely that IsVisible has some logic wherein it waits webdriver.timeouts.implicitlywait long to see if the element becomes visible.

As such, even if the element in question never exists, an IsNotVisible matcher takes a long time to resolve.

Noticed this was slowing down our test suite dramatically.

It's actually remarkably difficult to work out a way to implement IsNotVisible such that it is not affected by this implicit wait, because for instance driver#findElements also uses this implicit wait if it finds no elements.

Is there a way to work around this for now, and could this be resolved? The ideal behaviour would be that if an element is not visible at the start of the query, no waiting is done, and otherwise we wait only as long as it takes for the element to stop being visible.

It is easy to replicate this issue, just set webdriver.timeouts.implicitlywait =10000 for example, and then wait for a non existent element to not be visibile, observe it waits 10s

@wakaleo
Copy link
Member

wakaleo commented Nov 1, 2022

This can't be avoided, because as soon as you reference an element, the timeout will kick in. However, you can prefix the call with withTimeoutOf(Duration.ZERO), e.g. withTimeoutOf(Duration.ZERO).findElement("#button").isNotVisible()

@wakaleo wakaleo added the can't-fix We don't know how to do this at the moment label Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
can't-fix We don't know how to do this at the moment
Projects
None yet
Development

No branches or pull requests

2 participants