量角器给出“无法启动 Web 驱动程序会话”错误
Protractor gives "Unable to start a WebDriver session" error
我已经用webdriver-manager start
启动了服务器,但是当我尝试运行量角器时出现此错误:
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键无济于事。有什么想法吗?
根据相关的 github 问题,问题是chromedriver
找不到可执行chrome
浏览器 - 在不同的操作系统上,它会在不同的地方搜索它。
您需要将 chrome 安装在chromedriver
期望的位置,或者在binary
设置中指定可执行chrome
的路径:
capabilities: {
"browserName": "chrome",
"chromeOptions": {
binary: "D:/Program Files/Chrome/chrome.exe",
args: [],
extensions: [],
}
},
我使用JHipster生成了代码,并且在e2e不起作用的情况下遇到了类似的错误。我提供了二进制路径。但是npm run e2e
浏览器打开并在地址栏中显示data;
。
我在 args 之后的 chromeOptions 末尾洗牌并提供了二进制文件,它起作用了。
capabilities: {
browserName: 'chrome',
chromeOptions: {
args: process.env.JHI_E2E_HEADLESS
? [ "--headless", "--disable-gpu", "--window-size=800,600" ]
: [ "--disable-gpu", "--window-size=800,600" ],
binary: "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"
}
}
注意:当发生不受支持的网络驱动程序版本错误时,我还必须更新chrome版本。
相关文章:
- Javascript:selenium Web驱动程序isDisplayed()不工作
- Selenium Web驱动程序和javascript
- Xpath对Selenium Web驱动程序无效”;Xpath未找到”;
- Sencha禁用按钮和Selenium Web驱动程序
- 通过web驱动程序异步执行Javascript
- 如何使用Selenium Web驱动程序验证电子邮件
- 如何在另一个 html 标签内选择 web 元素硒 Web 驱动程序与 html 源
- Web 驱动程序管理器更新错误:EACCES,权限被拒绝
- 量角器 iOS 自动化:茉莉花规范超时.重置 Web 驱动程序控制流
- 如何在启动 Web 驱动程序实例之前通过命令行在 conf.js 中传递设备名称
- 由于“未解析的类型”错误,无法使用Web驱动程序运行Javascript
- 在Selenium Web驱动程序2.0中找不到元素
- 使用Java脚本跟踪网页中是否有Ajax请求,或者通过Selenium Web驱动程序拦截XMLHttpRequest
- web驱动程序的示例不起作用
- 元素找不到带有文本的selenium Web驱动程序
- 无法使用Javascript和Selenium Web驱动程序保存保存在表单元格中的文本
- Selenium Web驱动程序访问Jquery中的Javascript全局变量
- Selenium Web驱动程序使用Java查找Element
- C#Selenium Web驱动程序在Internet explorer中捕获javascript错误
- Watir Web驱动程序引发未知Javascript错误