量角器给出“无法启动WebDriver会话”错误 [英] Protractor gives "Unable to start a WebDriver session" error
问题描述
我已经用 webdriver-manager start
启动了一个服务器,但是当我尝试运行量角器时遇到这个错误:
使用位于http://127.0.0.1:4444/wd/hub
的selenium服务器[launcher]运行1个WebDriver实例
错误 - 无法启动WebDriver会话。
C:\ ... \\\
pm\\\
ode_modules\protractor\\\
ode_modules\selenium-webdriver\lib\atoms\error.js:113
var template = new Error(this.message);
^
UnknownError:未知错误:找不到Chrome二进制文件
我的配置文件看起来像这样:
exports.config = {
specs:[
'test / *。js '
],
功能:{
'browserName':'chrome'
},
seleniumAddress:'http://127.0.0.1: 4444 / wd / hub'
};
我也尝试过指向功能对象中的二进制文件以及将chromeDriver和seleniumServerJar键添加到徒劳无功。任何想法?
根据相关的github问题,问题在于 chromedriver
无法找到 chrome
浏览器可执行 - 在不同的操作系统上,它会在不同位置中搜索它。
您需要安装 chrome ,其中 chromedriver
预计它是,或者指定路径到 chrome
可在二进制
设置中执行:
<$ p
browserName:chrome,
chromeOptions:{
binary:D:/ Program Files / Chrome / chrome。 exe,
args:[],
extensions:[],
}
},
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
My config file looks like this:
exports.config = {
specs: [
'test/*.js'
],
capabilities: {
'browserName': 'chrome'
},
seleniumAddress: 'http://127.0.0.1:4444/wd/hub'
};
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?
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.
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屋!