HtmlUnit 的替代方案
迄今为止,我一直在研究可用的无头浏览器,发现 HtmlUnit 的使用非常广泛。与 HtmlUnit 相比,我们是否有任何具有可能优势的 HtmlUnit 替代方案?
谢谢 纳恩
I have been researching about the headless browsers available till to date and found HtmlUnit being used pretty extensively. Do we have any alternative to HtmlUnit with possible advantage compared to HtmlUnit?
Thanks
Nayn
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
据我所知,HtmlUnit`是最强大的无头浏览器。
你对此有什么问题吗?
As far as I know, HtmlUnit` is the most powerful headless browser.
What are you issues with it?
您还可以使用许多其他库来实现此目的。
我使用 jsoup - 它比任何其他 API 都要快得多。
There are many other libraries that you can use for this.
Well I use jsoup - it's pretty much faster than any other API.
具有虚拟帧缓冲区的 WebDriver 是唯一真正的替代方案。优点是使用真正的浏览器;缺点是设置起来比较麻烦,而且 API 也比较差。
WebDriver with a virtual framebuffer is the only real alternative. The advantage is that it uses a real browser; the disadvantage is that it's more of a pain to set up, and the API is much poorer.
我将在我的用例中使用 Selenium,因为它使我能够使用真正的浏览器,并且与 HtmlUnit 相比,它与现实世界中呈现的内容没有任何偏差。
我计划使用 Selenium2,它具有 WebDriver 集成并提供出色的 API 和很酷的修复。
谢谢
纳恩
I am going to use Selenium for my use case, since it offers me to use the real browser and no deviation from what it would render in real world as compared to HtmlUnit.
I am planning to use Selenium2 which has WebDriver integration and offers great API and cool fixes.
Thanks
Nayn
我通过 Qt 的 Python 绑定使用 webkit 作为无头浏览器: http: //www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qtwebkit.html
Webkit是Chrome和Safari使用的渲染引擎,非常灵活。
我选择它而不是 HtmlUnit 的原因之一是易于设置:
I use webkit as a headless browser, through Qt's Python bindings: http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qtwebkit.html
Webkit is the render engine used by Chrome and Safari, and is very flexible.
One of my reasons for choosing it over HtmlUnit was ease of setting up:
我还推荐硒。最棒的功能是您可以创建一个打开浏览器页面的客户端,您可以在其中看到每一步发生的情况。此外,为自动化测试创建宏是另一个很好的功能。
但是,如果您需要从网页中删除一些信息,HtmlUnit 比 selenium 更好。
I would also recommend Selenium. The great feature is you can create a client that opens a browser page that you can see what's happening at each step. Moreover, creating macros for automated tests is another good feature.
However, if you need to scrap some information from web page HtmlUnit is better than selenium.