<解決方法>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