My blog has moved!
You should be automatically redirected in 5 seconds. If not, visit http://samueladesoga.wordpress.com and update your bookmarks.

Wednesday, 24 February 2010

selenium.open timeouts for strange reasons

Have you ever been in situations when your selenium RC test times out after the selenium.open command, the page is loaded but selenium just tells you that it has timed out after 30000ms.

I had same problem in Java today when i got the selenium RC 1.0.3 and i fixed the problem by setting the selenium timeout to be "0". so i have done

@BeforeClass
public void setUp(){
selenium = new DefaultSelenium("localHost", 4444, "*iexplore", url);
selenium.start();
selenium.setTimeout("0");
}

and then i have used a waitForPageToLoad in each of the selenium methods that needs to wait - open, click .....

selenium.open(url);
selenium.waitForPageToLoad("5000");

selenium.click("btnG");
selenium.waitForPageToLoad("5000");


Hopefully you find this useful.

10 comments:

alexded said...

Thank you!
It was relly helpfull for me! :)

Anonymous said...

problem solved... thanks!

Kiran said...

Gr8 man. It solved my problem . Thansk a lot

Anonymous said...

This worked for us as well. Thanks a lot for posting this!

sideshowmanny said...

I had been putting the open lines inside a try but that meant it paused for 30 seconds every time. My tests are so much faster now - thanks!

Anonymous said...

You made my day! Been looking for this for about three days...

Anonymous said...

Worked for me also, thanks for posting!

Venu said...

thanks for the solution, I was struggling with the time out error for quite some time.

Anonymous said...

Ideally you should set a particular timeout greater than 30 seconds instead of setting it to 0.

leumascom said...

I dont agree with you because if you have experienced this problem before, you would notice that the page has completely loaded, setting the timeout greater than 30secs would only increase the time you have to wait before you get a timeout error.

You dont get this error always, but when you do it could frustrate you