PhantomJS unexpected load behavior with multiple pages

北慕城南 提交于 2019-12-05 08:58:45

I think the problem has to do with the fact that each webpage within PhantomJS is using the same QNetworkAccessManager, thus, the finished() signal is firing when each webpage object finishes loading. Modifications to PhantomJS's code might need to be made in order to fix this problem. I have noticed this before when trying to load multiple pages in parallel in PhantomJS. An application I'm working on uses QtWebkit and loads multiple pages simultaneously so I have to make sure that each webpage gets its own QNetworkAccessManager so that the finished() signals don't interfere with each other.

To crawl multiple pages, see the example follow.js that is bundled with the library. https://github.com/ariya/phantomjs/blob/master/examples/follow.js

You need to use recursion to wait for the current page to load before loading the next page.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!