量角器给出“无法启动WebDriver会话".错误 [英] Protractor gives "Unable to start a WebDriver session" error

查看:73
本文介绍了量角器给出“无法启动WebDriver会话".错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用 webdriver-manager start 启动了服务器,但是在尝试运行量角器时出现此错误:

I already have started a server with webdriver-manager start, but I get this error when I try to run protractor:

Using the selenium server at http://127.0.0.1:4444/wd/hub
[launcher] Running 1 instances of WebDriver
ERROR - Unable to start a WebDriver session.

C:\...\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:113
  var template = new Error(this.message);
                 ^
UnknownError: unknown error: cannot find Chrome binary

我的配置文件如下:

exports.config = {
    specs: [
        'test/*.js'
    ],

    capabilities: {
        'browserName': 'chrome'
    },
    seleniumAddress: 'http://127.0.0.1:4444/wd/hub'

};

我也尝试过指向功能对象中的二进制文件,以及添加chromeDriver和seleniumServerJar键均无济于事.有什么想法吗?

I have also tried pointing to the binary in the capabilities object as well as adding chromeDriver and seleniumServerJar keys to no avail. Any ideas?

推荐答案

根据相关的github问题,问题是 chromedriver 找不到可执行的 chrome 浏览器-在不同的操作系统上,它在

According to the relevant github issue, the problem is that chromedriver cannot find chrome browser executeable - on different operating systems it searches for it in different places.

您需要在 chromedriver 期望的位置安装 chrome ,或者在中指定可执行的 chrome 的路径>二进制设置:

You need to either have chrome installed where chromedriver expects it to be, or specify the path to the chrome executeable in the binary setting:

capabilities: {
    "browserName": "chrome",
    "chromeOptions": {
        binary: "D:/Program Files/Chrome/chrome.exe",
        args: [],
        extensions: [],
    }
},

这篇关于量角器给出“无法启动WebDriver会话".错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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