Reputation: 1050
I want to run protractor test using Firefox and phantomJS instead of chrome. However it will only run when I specify the 'chromeOnly: true' option and specify Chrome as the browser.
Otherwise it will crash and throw the error 'unable to start Webdriver Session'.
My protractor config:
'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
}
};
Upvotes: 0
Views: 6323
Reputation: 25177
The "chromeOnly" option means "connect directly to chrome" (vs. using a selenium server). When you remove that option, Protractor is expecting to talk to a selenium server to control a browser. See https://github.com/angular/protractor/blob/master/docs/server-setup.md.
Since Firefox now also supports a "direct connect" mode, the "chromeOnly" configuration option has been renamed to "directConnect". See https://github.com/angular/protractor/commit/3c048585ac811726d6c6d493ed6d43f6a3570bee
To use Firefox directly you can either leave the mis-named "chromeOnly" option set, or switch to "directConnect". Or, you can use Firefox via a selenium server (which just means you need to start the selenium server up, see the server-setup.md doc listed above).
Upvotes: 3
Reputation: 1316
use
multiCapabilities : [
{
'browserName' : 'chrome',
'chromeOptions' : {
'binary' : 'chrome.exe',
'args' : [],
'extensions' : []
},
{
'browserName' : 'firefox',
'chromeOptions' : {
'binary' : 'path to firefox.exe',
'args' : [],
'extensions' : []
}...
}
Upvotes: 0
Reputation: 449
Notice using phantomjs with protractor is disregarded. Taken from http://angular.github.io/protractor/#/browser-setup
Add phantomjs to the driver capabilities, and include a path to the binary if using local installation:
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']
}
Upvotes: 1