WebDriverException:消息:无法访问chrome [英] WebDriverException: Message: chrome not reachable

查看:232
本文介绍了WebDriverException:消息:无法访问chrome的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Selenium Python , 当我运行我的搜寻器时,出现此错误

I use Selenium Python, when I run my crawler I got this error

WebDriverException: Message: chrome not reachable
  (Driver info: chromedriver=2.9.248304,platform=Linux 3.16.0-4-amd64 x86_64)

我阅读了这个问题

我下载了chromedriver(二进制)并将其复制/粘贴到/usr/bin 我尝试过

I downloaded chromedriver (binary) and I copy/paste it to /usr/bin I tried by

driver = webdriver.Chrome('/usr/bin/chromedriver')

但是我有同样的错误

推荐答案

在protractor.configuration文件中,如果您具有以下内容:

In your protractor.configuration file, if you have the following:

capabilities: {
    'browserName': 'chrome',
    'chromeOptions': {
      'binary': 'path/to/chromedriver.exe';
    }   },

然后请删除该二进制文件,然后指向chromdriver,如下所示:

Then please remove that binary and instead point to the chromdriver like this:

//protractor.conf.js
chromeDriver: "C:/path/to/chromedriver.exe",
capabilities: {
    'browserName': 'chrome',
    'chromeOptions': {

    }
  },

注意我如何从功能中删除"binary"参数并添加"chromedriver:"属性.

Notice how I removed the 'binary' argument from the capabilities and added the "chromedriver:" attribute.

对于我来说,它消除了显示"

That worked for me in removing that annoying error that says "

    UnknownError: chrome not reachable
        28-Jul-2016 10:16:57      
    (Driver info: chromedriver=2.19.346078 (6f1f0cde889532d48ce8242342d0b84f94b114a1),
platform=Windows NT 10.0 x86_64)
 (WARNING: The server did not provide any stacktrace information)

最后确保像这样更新chromedriver和seleniumServer:

Lastly makes sure you update both chromedriver and seleniumServer like this:

webdriver-manager更新

webdriver-manager update

或 在下面运行此命令以更新到特定的chromedriver版本,即截至2016年4月10日的v2.24:

OR Run this command below to update to a SPECIFIC chromedriver version i.e v2.24 as of 10/04/2016:

webdriver-manager更新--versions.chrome 2.24

webdriver-manager update --versions.chrome 2.24

如果该命令不能被识别,则将其添加到Windows环境变量中的PATH中. webdriver-manager通常位于Protractor文件夹中,您可以使用npm install protractor来获得该文件夹

if it says that the command is not recognized, then add it to your PATH in windows environment variable. The webdriver-manager generally sits in the Protractor folder which you can get with npm install protractor

这篇关于WebDriverException:消息:无法访问chrome的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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