zoukankan      html  css  js  c++  java
  • 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

    问题解决!

     

  • 相关阅读:
    面向对象简介
    方法简述
    数组,排序方法
    循环结构
    类型转换、流程控制
    基本数据类型、变量、运算符
    基础语法、进制转换、环境配置
    python学习之字典
    python学习之字符串
    jmeter控制器
  • 原文地址:https://www.cnblogs.com/maybach/p/14719953.html
Copyright © 2011-2022 走看看