Protractor only runs Chrome
Protractor only runs Chrome
我想使用Firefox和phantomJS而不是chrome来运行量角器测试。然而,只有当我指定"chromeOnly:true"选项并指定Chrome作为浏览器时,它才会运行。
否则,它将崩溃并引发错误"无法启动Webdriver会话"。
我的量角器配置:
'use strict';
var paths = require('./.yo-rc.json')['generator-gulp-angular'].props.paths;
// An example configuration file.
exports.config = {
// The address of a running selenium server.
seleniumAddress: 'http://localhost:4444/wd/hub',
//seleniumServerJar: deprecated, this should be set on node_modules/protractor/config.json
// Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'firefox'
},
//chromeOnly: true,
baseUrl: 'http://localhost:8000/',
framework: 'jasmine',
// Spec patterns are relative to the current working directly when
// protractor is called.
specs: [paths.e2e + '/**/*.js'],
// Options to be passed to Jasmine-node.
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000
}
};
"chromeOnly"选项的意思是"直接连接到chrome"(与使用硒服务器相比)。当您删除该选项时,Protractor希望与硒服务器对话以控制浏览器。看见https://github.com/angular/protractor/blob/master/docs/server-setup.md.
由于Firefox现在也支持"直接连接"模式,"chromeOnly"配置选项已重命名为"directConnect"。看见https://github.com/angular/protractor/commit/3c048585ac811726d6c6d493ed6d43f6a3570bee
要直接使用Firefox,您可以保留错误命名的"chromeOnly"选项集,也可以切换到"directConnect"。或者,您可以通过selenium服务器使用Firefox(这意味着您需要启动selenium server,请参阅上面列出的server-setup.md文档)。
请注意,将phantomjs与量角器一起使用将被忽略。取自http://angular.github.io/protractor/#/browser-设置
将phantomjs添加到驱动程序功能中,如果使用本地安装,则包括二进制文件的路径:
capabilities: {
'browserName': 'phantomjs',
/*
* Can be used to specify the phantomjs binary path.
* This can generally be ommitted if you installed phantomjs globally.
*/
'phantomjs.binary.path': require('phantomjs').path,
/*
* Command line args to pass to ghostdriver, phantomjs's browser driver.
* See https://github.com/detro/ghostdriver#faq
*/
'phantomjs.ghostdriver.cli.args': ['--loglevel=DEBUG']
}
使用
multiCapabilities : [
{
'browserName' : 'chrome',
'chromeOptions' : {
'binary' : 'chrome.exe',
'args' : [],
'extensions' : []
},
{
'browserName' : 'firefox',
'chromeOptions' : {
'binary' : 'path to firefox.exe',
'args' : [],
'extensions' : []
}...
}
- Chrome WebKitGetUserMedia
- JQueryhide()不适用于Mozzilla,但适用于Chrome
- 在chrome.tabs.onCreated之后加载HTML页面
- chrome扩展中的navigator.geolocation.getCurrentPosition
- chrome扩展:尽管运行了at:documentidle,js脚本还是过早启动
- document.open/document.write没有正确地清除chrome中的文档——这是chrome的错误吗
- chrome扩展更改主机/域警告
- Chrome开发工具(如何知道我在调用哪个javascript对象)
- 如何在chrome扩展中重定向到html页面
- Chrome扩展没有't在重新加载之前考虑期权价值
- Google/html5语音识别JavaScript SDK Chrome网络工具包SpeechRecognition
- 激活chrome上的chrome.notifications对象
- 如何通过自己获得Chrome扩展的用户反馈/错误报告
- JS可以在Chrome中工作,但不能在Firefox中工作
- Chrome加载旧版本的Javascript文件
- 试图阻止Chrome通过扩展关闭
- 如何在chrome扩展中存储数据/结果,以及如何使用setTimeout使其只被调用一次
- JS表单提交"无法使用Chrome数据保护程序加载此页面.尝试重新加载页面.调试信息:POST CISmtuK
- 是什么让一个“;Uncaught RangeError:超过了最大调用堆栈大小“;错误(Chrome,在其他浏览器中显示
- Protractor only runs Chrome