Does explicit wait override implicit wait?

947 views
Skip to first unread message

chellbelle

unread,
Sep 14, 2012, 1:00:15 AM9/14/12
to webd...@googlegroups.com
If I set an implicit wait:
 
_driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS)
 
if I set an explicit wait after this with a shorter time, does the explicit wait override the value set above?
 
WebDriverWait wait = new WebDriverWait(_driver, 10);
WebElement a = wait.until(ExpectedConditions.elementToBeClickable(By.id("element")));
 
 
 
Thanks,
michelle
 
 

Luke Inman-Semerau

unread,
Sep 14, 2012, 11:58:19 AM9/14/12
to webd...@googlegroups.com
Nope... and this is an interesting scenario. What will happen in this case is the ExpectedCondition will attempt a driver.findElement (at time 0) and the server (the part of code that is executing in the actual browser) will keep trying to find the element for up to 30 seconds. If it doesn't find the element it will timeout after 30 seconds and the wait will finally get a response, since 30 seconds > 10 seconds it won't try again and it will throw a timeout exception.

 
 

--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To view this discussion on the web visit https://groups.google.com/d/msg/webdriver/-/ap21i-MYXU4J.
To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.

chellbelle

unread,
Sep 14, 2012, 6:12:19 PM9/14/12
to webd...@googlegroups.com
Thanks for your response. I did some investigation and testing and this is exactly what is happening.

kunal tambe

unread,
Feb 27, 2018, 8:32:22 AM2/27/18
to webdriver
Hi Luke... 

What will happen in the reverse scenario - 

If I set an implicit wait:
 
_driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS)
 
if I set an explicit wait after this with a shorter time, does the explicit wait override the value set above?
 
WebDriverWait wait = new WebDriverWait(_driver, 30);
WebElement a = wait.until(ExpectedConditions.elementToBeClickable(By.id("element")));

In such scenario, after how much time...it will throw nosuchelementexception, if element is not found.
Reply all
Reply to author
Forward
0 new messages