How to handle timeout error in web driver when we run selenium as automation pack?


i have created selenium journey with the Selenium IDE and i have converted to Selenium web driver code and imported to visual studio 2012 with the help of developer.

Automation pack contains 30 journeys in total. Those 30 Journey will run one after another and it is scheduled for 6 time / day.

My questions:

when i executing selenium journey manually by executing c# program, normal i couldn’t find any errors but when it is automated mode we used to get errors like out of 30 , 26 journeys are pass and 4 fail. if i run manually then those 4 journey ll pass. when it fail, error log mostly will be time out error.

My waiting time per page is about 60 seconds. It more than enough for web page.

In create failed journey make selenium untrusted for automation testing in my team.

Does anyone can suggest why i am getting this kind of error when set to automation mode?

Please suggest some solution for this.

Train Asked on December 8, 2014 in Selenium WebDriver.

Hey Abi,

Apologies, i did not notice it is a Timeout error you are talking about, I assumed it to be a normal Element not found error. To investigate that I should say implement heavy logging and based out of the testing logging time, take a look over your server logs as well and make a case for you to put this up in front of dev.

Lakshay Sharma

on December 9, 2014.

Hi Lakshay,

I have added 2 more wait cmd which is implicit wait and page load time out.

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

After adding this coding in my frame work, all time i am getting pass result for all my journeys for last 3 days 🙂    i hope it will  work  as same as now in future .

Thanks for you support Lakshay.

on December 12, 2014.

Superb then, Please close this question now

on December 12, 2014.

hey ,

am new to this forum. just one qq, how to close this question?

on December 15, 2014.


on December 15, 2014.
Add Comment
  • 3 Answer(s)
    Best answer

    Hi Abi,

    You got me wrong. I did not want you to increase the wait time to 60 secs and I assume that you are increasing that wait time in your implicitly wait statement. That is not the issue here.

    To cut it short just to find out the root cause, add Thread.sleep(1000) after every click(). You will see that after this no test will fail. If it is too much to do then implement logging and get all the failure elements and add sleep just before clicking those elements.

    This is not the solution but to get the idea what is going wrong here. If this works, then I will tell you the logic behind it.

    Lakshay Sharma

    Professor Answered on December 8, 2014.
    Add Comment


    You are correct and this always happens at initial statge of frameworks. Implement logging in your test and get the list of those entire elements on which selenium throws error intermittently. You need to implement wait smartly on those elements. Most of the time those elements load properly but once out of multiple they take some time to loador behave differently. If you are not worried about the time duration of the execution use enough thread sleep to give a smooth execution, although it is not recommended.

    Lakshay Sharma

    Professor Answered on December 8, 2014.
    Add Comment

    Thanks for reply Lakshay,

    Extending waiting period more than 60 Seconds seems to be not a good solution , for some journey i have increased waiting time as 100 Sec.
    after increasing as well those journey fails. so again i came back with 60 Sec for standard

    right now i am using sleep cmd, do you suggest any other wait commands solve this issue.

    Many thanks,

    Train Answered on December 8, 2014.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.