javaseleniumselenium-webdriverautomated-testsimplicitwait

Automation waits for the webpage to load for 10 minutes when i have given wait time as 10 seconds


I have a java selenium project .I have used implicit wait of 10 seconds using

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

Still the automation scripts wait for 10 minutes for the webpage to load. Here is the image that will be there 10 minutes and then it will fail.

What is the possible reason for it?


Solution

  • As already mentioned in the comments you need to set the page load timeout as well. The implicit wait timeout does not have any effect in this case. Try following line:

    driver.manage().timeouts().pageLoadTimeout(10, TimeUnit.SECONDS);
    

    In Selenium you have three different timeouts which all have different default values. Take a look at this answer which IMHO explains them quite good.