-2

I would like to know ,In selenium,If we add both implicit(10sec) and explicit wait(5sec) in script then which wait is applicable to element

steven35
  • 3,747
  • 3
  • 34
  • 48
  • Do you have a sample application where you have tried this? Also, there are already answers on StackOverflow that address this issue. i would recommend checking them out and removing this question if your question is already answered. – Shaswat Rungta Nov 07 '17 at 12:10
  • Possible duplicate of [What if Implicit and Explicit wait, both are used in Framework](https://stackoverflow.com/questions/25726897/what-if-implicit-and-explicit-wait-both-are-used-in-framework) – Shaswat Rungta Nov 07 '17 at 12:11

3 Answers3

0

The Documentation clearly mentions :

Do not mix implicit and explicit waits. Doing so can cause unpredictable wait times.

For example setting an implicit wait of 10 seconds and an explicit wait of 15 seconds, could cause a timeout to occur after 20 seconds.

Community
  • 1
  • 1
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
0

Either use Explicit OR Implicit Waits, dont use both at once

If you use both then

our webdriver first will follow the implicit wait and then follow the explicit wait since browser behavior will be sequential like other programing languages due single thread usage.

Explicit and Implicit Waits Waiting is having the automated task execution elapse a certain amount of time before continuing with the next step. You should choose to use Explicit Waits or Implicit Waits.

**

WARNING: Do not mix implicit and explicit waits. Doing so can cause unpredictable wait times. For example setting an implicit wait of 10 seconds and an explicit wait of 15 seconds, could cause a timeout to occur after 20 seconds.

**

Read Selnium DOC

iamsankalp89
  • 4,607
  • 2
  • 15
  • 36
0

If you are really in need with Explicit wait (i.e. wait until element to be clickable, invisible etc), you need to add below code above the explicit wait.

driver.manage().timeouts().implicitlyWait(0);

Once done with explicit wait, revert the implicit wait as much wait time you required for further elements. This will avoid cumulative wait time of both implicit and explicit wait.

Dinesh Kumar
  • 71
  • 1
  • 2
  • 8