Do we have any generic function to check if page has completely loaded in Selenium

前端 未结 5 1211
清歌不尽
清歌不尽 2020-11-21 22:56

I am trying to check if web page is loaded completed or not (i.e. checking that all the control is loaded) in selenium.

I tried below code:

new WebDr         


        
5条回答
  •  甜味超标
    2020-11-21 23:42

    I use selenium too and I had the same problem, to fix that I just wait also for the jQuery to load.

    So if you have the same issue try this also

    ((Long) ((JavascriptExecutor) browser).executeScript("return jQuery.active") == 0);
    

    You can wrap both function in a method and check until both page and jQuery is loaded

提交回复
热议问题