Problem with waitForPageToLoad("5000")

42 views
Skip to first unread message

Kris

unread,
Apr 13, 2007, 12:19:08 AM4/13/07
to selenium-users...@googlegroups.com
Hi,

I am using Selenium RC/Java/JUNIT...

In the Login Page.. after entering username and pwd, I will click submit button..It goes to another page with a message "Login Successful".

My problem is that when I click submit button, on faster machine waitForPageToLoad("5000"); works OK..On the slower machine it fails since within 5000 ms it won't load another page. It takes more than 30000 ms. another slowst machines takes atleast 1 minutes or so. I ma fed up with changing waitForPageToLoad time delay for each and every machine...

Is there any solution for me that... "just wait as long as it loads the next page. Don't worry about time delay".

selenium.type("username", "testuser");
selenium.type("password", "testuser");
selenium.click("submit");
selenium.waitForPageToLoad("5000");
assertTrue(selenium.isTextPresent("Login Successful"));

Do you think waitForCondition () does work? If yes, please help how can I use it for above piece of code..

Many Thanks...

udof

unread,
Apr 13, 2007, 2:43:39 AM4/13/07
to selenium-users...@googlegroups.com
WaitForPageToLoad stop waiting when the page has loaded. You can use 120000 milliseconds timeout and your test should continue after 2000 milliseconds when the page is loaded in that short time.

Udo

Kris

unread,
Apr 13, 2007, 1:37:49 PM4/13/07
to selenium-users...@googlegroups.com
Actually I don't want to increase time delay since it un-necessarily delays the test time for faster machines...

I am looking for something like...

while (text_in_next_page_contains == "some_thing")
{
just wait...
}

Eric Wendelin

unread,
Apr 14, 2007, 12:37:23 AM4/14/07
to selenium-users...@googlegroups.com
I think udof is right. waitForPageToLoad("100000") will work for you because selenium should detect the page load and stop waiting. Therefore your faster machines should not be slowed down. Correct me if this is currently not how it's working for you.

-dubness

Amit Wadhwa

unread,
Apr 16, 2007, 6:35:03 AM4/16/07
to selenium-users...@googlegroups.com
ideally, waitforpageload() should not wait if the page is loaded, else you can try something like this

while(!selenium.isElementPresent("some element on loaded page")){
if(selenium.isTextPresent("Login failed"){
verifyTrue(false);//test failed
break; //breaks from loop
}
waitforpageload(5000);
}

Kris

unread,
Apr 17, 2007, 4:55:31 PM4/17/07
to selenium-users...@googlegroups.com
For some reason this fails..

while(!selenium.isElementPresent("element on current page")){
if(selenium.isTextPresent("test_on_Next_page"){
verifyTrue(false);//test failed
break; //breaks from loop
}
waitforpageload(5000);
}

However, waitForPageLoad(500000); works Ok

Reply all
Reply to author
Forward
0 new messages