微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

java – Selenium Chrome驱动程序限制Web规模扩展

我打算在我的项目中使用Selenium Chrome Driver,它将用于对多个公共网站(类似皮划艇或skyscanner)进行网络抓取.因此,将会有一个REST GET端点,我的后端将启动无头Chrome以刮取多个网站,并最终返回一个被操纵的JSON.

我想知道Chrome驱动程序的可扩展性如何,因为它听起来像无头的Chrome实例需要在请求进入时启动.

更新:使用Google Chrome Headless的问题

解决方法:

请查看我在实施过程中注意到的幻像js的优缺点.希望这会有所帮助.

Cons:

1)It will fail to recognize the browser elements like id,xpath,csselector
when compared to chrome driver.
2)If you have login mechanism ,redirects won't work as you expect when compared to chrome driver.
3)You need to manually implement the custom logic for screen shots for the test failures if you need it.
4)If you want to switch between multiple drivers like chrome,html etc then it is very difficult

Pros:

1)Test case execution is faster when compared to chrome driver
2)No browser is required it will run without GUI. 
3)No much configurations are needed when compared to chromedriver.

您也可以使用html驱动程序,它比幻像快得多,但即使它有自己的限制,您需要在实现之前进行处理.

原文地址:https://codeday.me/bug/20190527/1163052.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐