0

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?

Community
  • 1
  • 1
shikhar
  • 85
  • 8
  • 1
    take a look at the answer of JeffC at this question https://stackoverflow.com/questions/41143520/driver-manage-timeouts-implicitlywait10-timeunit-seconds-does-not-working and maybe this question helps you https://stackoverflow.com/questions/43247670/limiting-the-timeout-period-for-selenium-findelement?rq=1 – JavaMan Aug 21 '19 at 06:04
  • I am using implicit-wait to wait for element presence on page, but after 10 seconds when the element doesnt show up the test case should fail. This happens after 10 minutes. – shikhar Aug 21 '19 at 06:23
  • check what is your page load timeout? – Murthi Aug 21 '19 at 07:36
  • @Murthi how to Check the page load timeout? Using any code or what? The page have some issue it never loads actually. So i wanted each test case to fail,instead each test case is getting failed after 10 minutes excatly – shikhar Aug 21 '19 at 09:40
  • AndiCover's answer may help you. – Murthi Aug 22 '19 at 05:24
  • Thank-you @Murthi for looking into it. PageLoadTimeout was the missing line. – shikhar Aug 22 '19 at 05:44

1 Answers1

2

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.

AndiCover
  • 1,724
  • 3
  • 17
  • 38