Description
Hello,
A colleague of mine stumbled upon this, and I found it to be worthy of creating an issue.
Let's say implicit wait is set to 20s, and suppose I want to wait for the disappearance of the element iDontExist
:
*** Settings ***
Library SeleniumLibrary implicit_wait=20.0
*** Test Cases ***
Testing implicit wait
Open browser http://www.google.com chrome
Wait until page does not contain element //iDontExist
This will result in a full 20 seconds wait until it returns successfully. I inspected the code responsible, and indeed, it reflects the finding exactly:
@keyword
def wait_until_page_does_not_contain_element(self, locator, timeout=None,
error=None):
"""Waits until element ``locator`` disappears from current page.
Fails if ``timeout`` expires before the element disappears. See
the `Timeouts` section for more information about using timeouts and
their default value and the `Locating elements` section for details
about the locator syntax.
``error`` can be used to override the default error message.
"""
self._wait_until(
lambda: self.find_element(locator, required=False) is None,
"Element '%s' did not disappear in <TIMEOUT>." % locator,
timeout, error
)
In my opinion that is not intuitive. I would expect this keyword to return as soon as the element is not found. Maybe there's use cases for the current implementation also, in which case maybe a parameter can distinguish between both behaviors or something?
I just wanted to bring this to your attention and I'm curious to the clarification.
Thanks,
Bart
My environment:
Browser: Chrome 73.0.3683.86 (64 bits)
Browser driver: ChromeDriver version 73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72)
Operating System: Windows 10 version 1703 (build 15063.1631)
Libraries
- Robot Framework: 3.1.1
- Selenium: 3.141.0
- SeleniumLibrary: 3.3.1
- Interpreter: Python 2.7.16 (v2.7.16:413a49145e) (64 bits)
PS Judging by the implementation I would expect this to occur regardless of using implicit or explicit wait.