开发者

Any alternative for waitForPageToLoad

I am developing automated test cases f开发者_如何学Goor my app using selenium RC in python 2.7. When I am using wait_for_time_to_load(time) is throwing error as the timeout is variable in my app. Can anyone suggest me any other alternative for the function "wait_for_page_to_load" which does not take time as a parameter. Thanks


Just to add to @rs79's code

    int iteration = 0;
    //checks the presence of element till a given no of iterations(say 20) to avoid infinite loop
    while(!(selenium.isElementPresent("yourelement")) && iteration < 20){
        Thread.sleep(1000);
        iteration++;
    }

again this is in java, hopefully you can apply same logic in python.


You could check for the absence of an expected element and keep waiting till it appears.

while (!(selenium.isElementPresent("your_element_identifier")==true)) {
            selenium.setSpeed("10");
            Thread.sleep(10);
        }

Evidently, the code above is in Java, but applying the same login in Python should be trivial.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜