How to wait for page loading when using casperjs?

后端 未结 7 1195
名媛妹妹
名媛妹妹 2020-12-14 17:29

I am trying to scrape a webpage which has a form with many dropdowns and values in the form are interdependent. At many point I need the code to wait till the refresh of the

7条回答
  •  鱼传尺愫
    2020-12-14 17:58

    Just evaluate document.readyState to be complete or interactive. Then it's loaded.

    This is an implementation with a while, but maybe can be done with interval...

    this.then(function () {
     while(this.evaluate(function () { return document.readyState != 'complete' && document.readyState != 'interactive'; })) {}
    });
    

提交回复
热议问题