An NPM wrapper for Selenium Webdriver, a browser automation framework including Chromedriver, IEDriver (when applicable), Ghostdriver (which is part of PhantomJS) and IOSDriver.
Thanks to https://github.com/Obvious/phantomjs for the process how to download / handle varying binaries using NPM.
npm install webdrvr
What this is really doing is just grabbing a particular "blessed" (by this module) version of Selenium, Chromedriver, IEDriver and PhantomJS. As new versions are released and vetted, this module will be updated accordingly.
bin/webdrvr [selenium arguments] // see "bin/webdrvr -h" for possible arguments
var childProcess = require('child_process');
// passing information about current environment
var webdrvr = require('webdrvr');
var childArgs = webdrvr.args.concat([
'-jar', webdrvr.selenium.path
'-p', '44524'
// further selenium arguments
]);
childProcess.execFile('java', childArgs, function(err, stdout, stderr) {
// server got started
});
Running via selenium-webdriver
var remote = require('selenium-webdriver/remote');
var webdrvr = require('webdrvr');
// further options: https://code.google.com/p/selenium/source/browse/javascript/node/selenium-webdriver/remote/index.js#30
var server = new remote.SeleniumServer(webdrvr.selenium.path, {
args: webdrvr.args
});
server.start().then(function(url) {
console.log('Selenium standalone server started at ' + url);
});
// stopping the server
// server.stop();
The NPM package version tracks the version of Selenium that will be installed, with an additional build number that is used for revisions of the installer.
As such 2.33.0-0 and 2.33.0-1 will both install Selenium 2.33.0 but the latter has newer changes to the installer.