selenium.waitForPageToLoad("3000") timing out after 3000 ms
i am running some very simple tests using selenium, some tests are failing randomly on my slow build machine and giving this error:
com.thoughtworks.selenium.SeleniumException: Timed out after 3000ms
against this code:
seleniumStart();
selenium.open("*****");
selenium.waitForPageToLoad("3000");
selenium.type("j_username", LoginTest.DEFAULT_ADMIN_USERNAME );
selenium.type("j_password", LoginTest.DEFAULT_ADMIN_PASSWORD );
selenium.click("loginbutton");
selenium.waitForPageToLoad("3000");
selenium.click("nav_form:managepatients");
it uses spring security, and jsf as front end . does anyone know why this is hapenning? i have been stuck with this for 2 days开发者_运维知识库.
thanks in advance.
3000 ms is only 3 seconds, which may not be enough time for the page to load sometimes, so maybe you just need to raise the timeout? 30000 ms for waitForPageToLoad would seem more appropriate.
What's worked for me in a more robust fashion than the selenium.waitForPageToLoad("xxxxxx");
is -
while (!(selenium.isElementPresent("any element on page")==true)) {
selenium.setSpeed("10");
Thread.sleep(10);
}
This enables you to wait till some pre-determined element loads, and then perform the subsequent actions. It's also good to measure the response time...
Probably the page is not loading in that time, have you tried raising the timeout to say 30000 if that does not work your best bet is to watch the browser while selenium runs
You can increase the wait for page to load time .
OR
use : selenium.setSpeed("2000");
- will wait for 2 seconds It Runs each command in after setSpeed delay by the number of milliseconds mentioned in setSpeed. So theres a gap of 2 second in this case after each operation , which will help the operation to complete and than will handover to the next operation.
精彩评论