Open link in PhantomJS synchronously

前端 未结 1 719
春和景丽
春和景丽 2020-12-21 19:47

I want to know is there any way to click link (open link) on PhantomJS synchronously. First page must be opened first, then click link on the first page to go to second page

相关标签:
1条回答
  • 2020-12-21 19:51

    Clicking a link is always synchronously. What happens afterwards is always asynchronously, because of the asynchronous nature of JavaScript.

    There are multiple ways to wait for the next page:

    • Static amount of time with setTimeout,
    • Dynamic waiting for a condition with waitFor,
    • Next page load by registering to page.onLoadFinished before the click,
    • Wait until all outstanding requests are finished (one and two) or
    • A combination of those four methods.
    0 讨论(0)
提交回复
热议问题