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驱动程序,它比幻像快得多,但即使它有自己的限制,您需要在实现之前进行处理.

转载注明原文:java – Selenium Chrome驱动程序限制Web规模扩展 - 代码日志