Skip to content

Node WebDriver: Can't use Loopback option for DriverService via SeleniumServer #1066

@joeskeen

Description

@joeskeen

I've been trying to run Protractor while on my company's VPN while working remotely. Whenever the server starts, it gets my IP address of my home network (i.e. 192.168...), and attempts to use that as the address for the Selenium server.

Selenium standalone server started at http://192.168.1.127:56359/wd/hub

As the VPN prevents local network traffic, the connection hangs and then gives a timeout error.

Error: Timed out waiting for the WebDriver server at http://192.168.1.127:56359/wd/hub

After hours of tracking down the cause of this issue, I found the following in /javascript/node/selenium-webdriver/remote/index.js:

There is a loopback option documented (line 39):
https://github.com/SeleniumHQ/selenium/blob/master/javascript/node/selenium-webdriver/remote/index.js#L39

The DriverService seems to use this loopback option to determine whether or not to use a loopback address (i.e. 127.0.0.1) (line 82):
https://github.com/SeleniumHQ/selenium/blob/master/javascript/node/selenium-webdriver/remote/index.js#L82

I tested this out by changing the source to always set loopback to true, and my problem using Protractor with the VPN went away. So I went on a quest to figure out how I could get that option to be set through my Selenium / Protractor configuration.

Here's what I found:

Although loopback is documented, the typedef in the same comment does not include the loopback option (line 53):
https://github.com/SeleniumHQ/selenium/blob/master/javascript/node/selenium-webdriver/remote/index.js#L53

When SeleniumServer is initialized, it calls DriverService, but never passes along a loopback option. Consequently, the code at line 82 setting this.loopbackOnly_ will always resolve to false. (line 278, 193)
https://github.com/SeleniumHQ/selenium/blob/master/javascript/node/selenium-webdriver/remote/index.js#L278
https://github.com/SeleniumHQ/selenium/blob/master/javascript/node/selenium-webdriver/remote/index.js#L193

I was able to capture a relevant stack trace from the DriverService constructor:

    at SeleniumServer.DriverService (~/project/node_modules/protractor/node_modules/selenium-webdriver/remote/index.js:76:32)
    at new SeleniumServer (~/project/node_modules/protractor/node_modules/selenium-webdriver/remote/index.js:268:17)
    at LocalDriverProvider.setupEnv (~/project/node_modules/protractor/lib/driverProviders/local.js:80:18)
    at Runner.run (~/project/node_modules/protractor/lib/runner.js:254:31)
    at TaskRunner.run (~/project/node_modules/protractor/lib/taskRunner.js:123:19)
    at createNextTaskRunner (~/project/node_modules/protractor/lib/launcher.js:223:20)
    at ~/project/node_modules/protractor/lib/launcher.js:246:7
    at _fulfilled (~/project/node_modules/protractor/node_modules/q/q.js:797:54)
    at self.promiseDispatch.done (~/project/node_modules/protractor/node_modules/q/q.js:826:30)
    at Promise.promise.promiseDispatch (~/project/node_modules/protractor/node_modules/q/q.js:759:13)

Is there any way to trigger the loopback option in DriverService, or will some work be required to plumb the loopback option through from configuration or command-line arguments?

Environment: Mac OS X 10.10.5, Pulse Secure VPN

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions