美文网首页
2019-03-11

2019-03-11

作者: 侯文虎 | 来源:发表于2019-03-11 11:07 被阅读0次

centos6.x服务器上使用selenium+chromedriver遇到的问题

  需要在服务器上运行selenium+chrome,首先需要安装chrome浏览器,centos6.x上安装多次都没有安装成功chrome浏览器,后来改成安装低版本的浏览器安装成功(2015年版本),但无法用webdriver驱动,显示错误为:

selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally

(Driver info: chromedriver=2.20.353124 (035346203162d32c80f1dce587c8154a1efa0c3b),platform=Linux 2.6.32-696.10.1.el6.x86_64 x86_64)

  只有转换思路,selenium+phantomjs在服务器上是可以运行的,虽然selenium不再支持phantomjs,但是程序运行还是没有问题的,虽然有warning, 直接用warnings.filterwarnings("ignore")忽略警告,或者使用旧版本的selenium就不会有warning,phantomjs是不用像chrome下载浏览器的,也不用下载对应版本的chromedriver,在webdriver.PhantomJS('路径')中写好路径就可以运行了,故后续在6.x的服务器上运行模拟浏览器就用selenium+phantomjs

相关文章

网友评论

      本文标题:2019-03-11

      本文链接:https://www.haomeiwen.com/subject/dzsvpqtx.html