WebDriverException: Message: Service chromedriver unexpectedly exited. Status code was: 127


背景
使用selenium驱动Chrome, 但是执行的时候报错,

WebDriverException: Message: Service chromedriver unexpectedly exited. Status code was: 127

这是因为缺少 chromedriver依赖

环境: ubuntu20.04 64

 

操作
驱动Chrome程序

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

chrome_options = Options()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--disable-gpu')
chrome_options.binary_location = './chrome'
driver = webdriver.Chrome(chrome_options=chrome_options, executable_path="./chromedriver")
driver.get("http://www.duo.com")

查看 chromedriver 需要的依赖:
执行

./chromedriver --version

显示
/chromedriver: error while loading shared libraries: libgconf-2.so.4: cannot open shared object file: No such file or directory

 

 

安装依赖:

sudo apt-get install libgconf-2-4

 

问题解决!

 

 


免责声明!

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



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