我计划在我的项目中使用 Selenium Chrome 驱动程序,该驱动程序将用于对多个公共网站(例如 kayak 或 skyscanner)进行网页抓取。因此,将会有一个 REST GET 端点,我的后端将在其中启动无头 Chrome 来抓取多个网站,并最终返回经过操作的 JSON。
我想知道 Chrome 驱动程序的可扩展性如何,因为听起来每当有请求传入时就需要启动无头 Chrome 实例。
更新:使用 Google Chrome Headless 的问题
请找出我在实施过程中注意到的 phantom 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 驱动程序,它比 phantom 更快,但即使它也有其自身的限制,您需要在实现之前注意这些限制。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)