Skip to content

ExpectedConditions.not is not working correctly #332

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
JamesZoft opened this issue Mar 13, 2015 · 2 comments
Closed

ExpectedConditions.not is not working correctly #332

JamesZoft opened this issue Mar 13, 2015 · 2 comments
Labels
C-java Java Bindings I-defect Something is not working as intended

Comments

@JamesZoft
Copy link

Details of the setup used to test this:

Windows 7
ChromeDriver (chrome ver 41)
Java bindings, selenium version 2.44.0

Java and html+js code to reproduce the issue: https://gist.github.com/anonymous/c81bb74d9bbcd94b0398

What should happen: The test should pass as the div with id 'woop' is being removed via assigning the innerHTML.
What happens: The wait times out after waiting for the ExpectedConditions specified (for the element with id 'woop' to not be present).

You can see the same behaviour with visibilityOfElementLocated and using ExpectedConditions.not - here it's even more obvious that this is broken as using invisibilityOfElementLocated works just fine where using ExpectedConditions.not(ExpectedConditions.visibilityOfElementLocated) doesn't.

@andreastt andreastt added C-java Java Bindings I-defect Something is not working as intended labels Mar 13, 2015
@lukeis
Copy link
Member

lukeis commented Mar 14, 2015

Ok... so tracked this one down. Basically the ExpectedConditions.not is unequipped to handle the inversion of Conditions where they throw an exception (that is ignored by the Wait class, in this case NoSuchElementException is the one thrown and ignored).

I don't see a good way to fix this as the ExpectedConditions.not does not have access to the list of Ignored exceptions when it is evaluating it's criteria.

For this particular use case the proper ExpectedCondition to use is ExpectedConditions.invisibilityOfElementLocated (since it considers elements not found to be 'invisible').

With this 'workaround' I'm going to close this issue, but I've updated the JavaDoc for ExpectedConditions.not to explain this gotcha.

@lukeis lukeis closed this as completed in c9cb688 Mar 14, 2015
@andreastt
Copy link
Member

@lukeis, thanks for making the necessary updates to the API docs.

@lock lock bot locked and limited conversation to collaborators Aug 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C-java Java Bindings I-defect Something is not working as intended
Projects
None yet
Development

No branches or pull requests

3 participants