Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Commit b693256

Browse files
Tim Roesjuliemr
Tim Roes
authored andcommitted
feat(webdriver): allow configuration of all SeleniumServer arguments
You can now pass a complete object of configuration for the SeleniumServer class. This allows enabling loopback on the selenium server.
1 parent 9532779 commit b693256

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

docs/referenceConf.js

+4
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ exports.config = {
3838
// seleniumArgs: ['-browserTimeout=60']
3939
// Ignored if seleniumServerJar is null.
4040
seleniumArgs: [],
41+
// Can be an object which will be passed to the SeleniumServer class as args.
42+
// If you specify `args` or `port` in this object, it will overwrite the values
43+
// set via `seleniumPort` and `seleniumArgs`.
44+
localSeleniumStandaloneOpts: null,
4145
// ChromeDriver location is used to help find the chromedriver binary.
4246
// This will be passed to the Selenium jar as the system property
4347
// webdriver.chrome.driver. If null, Selenium will

lib/driverProviders/local.js

+14-5
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,24 @@ LocalDriverProvider.prototype.setupEnv = function() {
7272

7373
log.puts('Starting selenium standalone server...');
7474

75+
var serverConf = this.config_.localSeleniumStandaloneOpts || {};
76+
77+
// If args or port is not set use seleniumArgs and seleniumPort
78+
// for backward compatibility
79+
if (serverConf.args === undefined) {
80+
serverConf.args = this.config_.seleniumArgs || [];
81+
}
82+
if (serverConf.port === undefined) {
83+
serverConf.port = this.config_.seleniumPort;
84+
}
85+
7586
// configure server
7687
if (this.config_.chromeDriver) {
77-
this.config_.seleniumArgs.push('-Dwebdriver.chrome.driver=' +
88+
serverConf.args.push('-Dwebdriver.chrome.driver=' +
7889
this.config_.chromeDriver);
7990
}
80-
this.server_ = new remote.SeleniumServer(this.config_.seleniumServerJar, {
81-
args: this.config_.seleniumArgs,
82-
port: this.config_.seleniumPort
83-
});
91+
92+
this.server_ = new remote.SeleniumServer(this.config_.seleniumServerJar, serverConf);
8493

8594
//start local server, grab hosted address, and resolve promise
8695
this.server_.start().then(function(url) {

0 commit comments

Comments
 (0)