chenglou / node-huxley

Codeless front-end testing.
MIT License
361 stars 29 forks source link

Pass additional options (capabilities) to the driver #38

Closed wereHamster closed 10 years ago

wereHamster commented 10 years ago

Some of my tests require the Experimental JavaScript Features flag to be enabled in chrome. This flag is also exposed as --js-flags=--harmony on the commandline. There does not seem to be any way to pass custom options to the webdriver.

I managed to find the location in the code where the webdriver is initialized and hardcode the commandline arguments there. In the file source/browser.js, the _open function at the very top:

  } else if (browserName === 'chrome') {
    browser = webdriver.Capabilities.chrome().set('chromeOptions', {
        args: ['--js-flags=--harmony']
    });
    serverUrl = 'http://localhost:9515';
  }

Btw, the selenium webdriver documentation is severely lacking. I couldn't find any comprehensive documentation of the JavaScript webdriver API. I found the above snippet through google search.

chenglou commented 10 years ago

Yeah the js docs are really bad... I'll check this and test it a bit.

chenglou commented 10 years ago

@wereHamster is this what you're looking for? https://github.com/chenglou/node-huxley/commit/0faf71ea1efbec298d4f19e1c4a5e8a230149e7d#diff-4663341696a08eef2606d83e7fb282a9R60

chenglou commented 10 years ago

Exposed more correctly in 0.8.0: https://github.com/chenglou/node-huxley/wiki/API