You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.
What steps will reproduce the problem?
1. Run the attached program
2. View the console output
What is the expected output? What do you see instead?
Expected output is something like:
Implicit wait: Find element took 3.148129654 s
Explicit wait: Find element took 3.160037161 s
Explicit and implicit wait: Find element took 3.136456231 s
Instead it is more like:
Implicit wait: Find element took 3.148129654 s
Explicit wait: Find element took 3.160037161 s
Explicit and implicit wait: Find element took 6.136456231 s
Selenium version: 2.25.0
OS: Windows 7
Browser: Program uses Firefox but browser is irrelevant to behavior
Browser version: 14.0.1
Please provide any additional information below.
The attachment is a simple program that displays three cases: a WebDriver with an implicit
wait set, a WebDriver without an implicit wait being used by a WebDriverWait, and a
WebDriver with an implicit wait and being used by a WebDriverWait. In the last case,
the implicit wait is *higher* than the duration set on the WebDriverWait. In each case,
the WebDriver will go to google and try to find an element that is not present, so
it will trigger whichever form of waiting is active. In the third case though, the
longer implicit wait is used, meaning the duration set in the constructor of the WebDriverWait
is essentially meaningless.
If the implicit wait is lower than the WebDriverWait's duration, then the behavior
is as expected, it's when the implicit wait is higher that it becomes a problem.
We recommend never combining implicit and explicit waits because of confusing cases
such as this. Setting the implicit wait changes state on the WebDriver server, forcing
a wait on every findElement/findElements call (hence the name "implicit wait").
Explicit waits are a pure-client side construct that involves polling until some condition
is met. If you have implicit waits enabled, any findElement commands inside your explicit
wait will be subject to its timeout.
I agree combining them is never a good idea, however this is often a problem with PageObjects
that may be using WebDriverWait. The page object has no access to any implicit waits
that may be set on the WebDriver it receives--besides setting it to a new value, it
can't get the previous one, per issue 2227. I don't know if it's a good practice to
have a page object alter the state of the WebDriver it's given (except what page the
WebDriver was on, obviously), but I suppose that's necessary in this case.
Thanks for the explanation!
Originally reported on Google Code with ID 4471
Reported by
smith.6606
on 2012-08-27 17:50:59- _Attachment: [ImplicitWaitTest.java](https://storage.googleapis.com/google-code-attachments/selenium/issue-4471/comment-0/ImplicitWaitTest.java)_
The text was updated successfully, but these errors were encountered: