Selenium无法在CentOS中启动Chromedriver [英] Selenium fails to start Chromedriver in CentOS

查看:118
本文介绍了Selenium无法在CentOS中启动Chromedriver的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试从Selenium启动Chromedriver

I try to start Chromedriver with Selenium

from selenium import webdriver
driver = webdriver.Chrome()
driver.get("http://www.google.com/")
print(driver.title)

和以下错误消息:

raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally
 (Driver info: chromedriver=2.33.506092,platform=Linux 3.10.0-693.5.2.el7.x86_64 x86_64)

我正在使用这些:

[root@jdu4e00u53f7 workspace]# ll /usr/local/bin/chromedriver
lrwxrwxrwx 1 root root 17 11月 14 00:31 /usr/local/bin/chromedriver -> /opt/chromedriver




  • CentOS 7.3

  • Python(3.6.2)

  • 硒(3.7.0)

  • Google Chrome浏览器(62.0.3202.89)

  • chromedriver(2.9)/我改成chromedriver = 2.33.506092

  • Xvfb

    • CentOS 7.3
    • Python(3.6.2)
    • selenium (3.7.0)
    • Google Chrome (62.0.3202.89)
    • chromedriver(2.9)/ I changed to chromedriver=2.33.506092
    • Xvfb
    • ps,我也尝试过


      1. driver = webdriver.Chrome('/ usr / local / bin / chromedriver'),它不起作用...

      1. driver = webdriver.Chrome('/usr/local/bin/chromedriver'),it not work...

      test.py
      输出

      ref: Selenium无法启动Chromedriver


      1. 在我的服务器上在后台启动Xvfb:
        Xvfb:0 -ac -screen 0 1024x768x24&
        也不起作用

      re f:未知错误:Chrome无法启动:异常退出(驱动程序信息:chromedriver = 2.9

      推荐答案

      从上述配置中可以明显看出您正在使用 Selenium v​​3.7.0 Google Chrome 62.0 chromedriver v2.9 不兼容。因此,我们看到错误 WebDriverException:消息:未知错误:Chrome无法启动:异常退出

      It is much evident from your mentioned configuration that you are using Selenium v3.7.0, Google Chrome 62.0 along with chromedriver v2.9 which is not compatible. Hence we are seeing the error WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally


      ChromeDriver v2.33 的发行说明中明确提到 支持Chrome v60-62

      The Release Notes of ChromeDriver v2.33 clearly mentions Supports Chrome v60-62



      解决方案:



      chromedriver v2.33 / rel = nofollow noreferrer> 此链接 并执行您的测试用例。

      Solution:

      Download the latest chromedriver v2.33 from this link and execute your testcase.

      尝试下面的代码块:

      from selenium import webdriver
      driver = webdriver.Chrome(executable_path='/usr/local/bin/chromedriver')
      driver.get('https://www.google.co.in')
      print("Page Title is : %s" %driver.title)
      driver.quit()
      




      OR

      OR



      from selenium import webdriver
      driver = webdriver.Chrome(executable_path='/opt/chromedriver')
      driver.get('https://www.google.co.in')
      print("Page Title is : %s" %driver.title)
      driver.quit()
      

      这篇关于Selenium无法在CentOS中启动Chromedriver的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆