<解决方法>Centos安装使用Chromedriver


一、安装Chrome

我安装好Centos系统后,就在网上去找Chrome浏览器的安装方法,使用过yumrpm都安装不上,会报错,然后询问公司的运维,他给我了个包,然后使用:yum localinstall 包名

就安装成功了,安装的路径默认是/opt/google/chrome/  

yum localinstall  安装rpm会自动的安装依赖,不需要单独的安装依赖

 

下面有对应的版本可用,亲测了:

Chrome版本:68.0.3440.106

Chromedriver版本:2.41

下载地址:

https://pan.baidu.com/s/1S8YBVQpOhzaceF9NsixU7A

 

二、下载Chromedriver

所有版本下载地址:

http://chromedriver.storage.googleapis.com/index.html

 

三、使用Chromedriver

借鉴地址:https://blog.csdn.net/blueheart20/article/details/81566903

我用的是pythonselenium框架来使用Chromedriver

直接driver.Chrome()是会报错: Chrome failed to start: exited abnormally,需要使用带参数的启动方法:

1 chrome_options = webdriver.ChromeOptions()
2 chrome_options.add_argument('--headless')
3 chrome_options.add_argument('--no-sandbox')
4 chrome_options.add_argument('--disable-gpu')
5 chrome_options.add_argument('--disable-dev-shm-usage')

 

加上之后就运行成功了

备注:

一、解决 Requires: libc.so.6(GLIBC_2.14)(64bit):

https://blog.csdn.net/zhou_shaowei/article/details/76066934

https://blog.csdn.net/clirus/article/details/62425498

https://blog.csdn.net/changcsw/article/details/79761620

二、Chrome对应的driver版本

三、运行chromedriver报错

报错:[1570616532.097][SEVERE]: bind() returned an error, errno=99: Cannot assign requested address (99)

解决方法:运行时,添加参数:--whitelisted-ips  就不会有这个错误

[root@sonny ]# chromedriver --whitelisted-ips

参考:https://stackoverflow.com/questions/55844788/how-to-fix-severe-bind-failed-cannot-assign-requested-address-99-while


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM