Skip to content

Commit

Permalink
ChromeDriver 2.10.267517 binds to the loopback address instead of 0.0…
Browse files Browse the repository at this point in the history
….0.0, so

only attempt to connect using the loopback address.

Fixes issue 7300.
  • Loading branch information
jleyba committed May 5, 2014
1 parent cda6ae2 commit b5e6e96
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions javascript/node/selenium-webdriver/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

* Removed deprecated functions `Promise#addCallback()`,
`Promise#addCallbacks()`, `Promise#addErrback()`, and `Promise#addBoth()`.
* FIXED: 7300: Connect to ChromeDriver using the loopback address since
ChromeDriver 2.10.267517 binds to localhost by default.

## v2.41.0

Expand Down
1 change: 1 addition & 0 deletions javascript/node/selenium-webdriver/chrome.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ ServiceBuilder.prototype.build = function() {
var args = this.args_.concat(); // Defensive copy.

return new remote.DriverService(this.exe_, {
loopback: true,
port: port,
args: webdriver.promise.when(port, function(port) {
return args.concat('--port=' + port);
Expand Down
9 changes: 8 additions & 1 deletion javascript/node/selenium-webdriver/remote/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ var promise = require('../').promise,
/**
* Configuration options for a DriverService instance.
* <ul>
* <li>
* <li>{@code loopback} - Whether the service should only be accessed on this
* host's loopback address.
* <li>{@code port} - The port to start the server on (must be > 0). If the
* port is provided as a promise, the service will wait for the promise to
* resolve before starting.
Expand Down Expand Up @@ -73,6 +76,9 @@ function DriverService(executable, options) {
/** @private {string} */
this.executable_ = executable;

/** @private {boolean} */
this.loopbackOnly_ = !!options.loopback;

/** @private {(number|!webdriver.promise.Promise.<number>)} */
this.port_ = options.port;

Expand Down Expand Up @@ -176,7 +182,8 @@ DriverService.prototype.start = function(opt_timeoutMs) {

var serverUrl = url.format({
protocol: 'http',
hostname: net.getAddress() || net.getLoopbackAddress(),
hostname: !self.loopbackOnly_ && net.getAddress() ||
net.getLoopbackAddress(),
port: port,
pathname: self.path_
});
Expand Down

0 comments on commit b5e6e96

Please sign in to comment.