Explicit wait is not working if I use it with implicit wait in my code

234 views Asked by At

I have a base class in which I setup the driver and mention implicit wait of 15 seconds

driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);

Now in my test class I want to use webdriver wait for a particular element and I declare my webdriver wait as follows

WebDriverWait wait = new WebDriverWait(driver,30); wait.until(ExpectedConditions.visibilityOf(driver.findElement(By.id("a")));

But what happens is that when my code only waits for 15 seconds on the above line, where as it should wait for 30 seconds

1

There are 1 answers

1
Marek On

as I understand it, this is correct behaviour

simple solution is not to use implicit waits and use only explicit

more detailed answer can be found here, it's from Jim Evans (member of the Selenium team) https://stackoverflow.com/a/15174978/2818711