Pilot a selenium grid from nodejs and run several scenarios in parallel.
An example can be found in the example directory.
Simply run bin/selenium-grid example/google.js example/yahoo.js.
Via npm:
$ npm install selenium-gridvia Git:
$ git clone https://github.com/themouette/selenium-grid.git && npm installAdd a .selenium-grid.json in your home directory or a selenium-grid.json to
your project root.
{
"browsers": [
{ "browserName": "internet explorer", "version": "8", "platform": "XP" },
{ "browserName": "chrome", "version": "latest" },
{ "browserName": "firefox", "version": "latest" }
],
"remoteCfg": {
"protocol": "http:",
"hostname": "127.0.0.1",
"port": "4444",
"path": "/wd/hub"
}
}If you use saucelabs, just use following configuration:
{
"browsers": [
{ "browserName": "internet explorer", "version": "8", "platform": "Windows XP" },
{ "browserName": "chrome", "version": "27" },
{ "browserName": "firefox", "version": "23" }
],
"remoteCfg": {
"hostname": "ondemand.saucelabs.com",
"port": 80,
"username": "YOUR USERNAME",
"accessKey": "YOUR-ACCESS-KEY"
}
}$ node_modules/selenium-grid/bin/selenium-grid --recursive tests/functionalTo learn more about command line arguments, use
node_modules/selenium-grid/bin/selenium-grid --help
To extend browser capabilities or do anything else before test executions,
simply use the before option.
Runner instance will be made available through grid variable and config is
available as config:
//pre.js
// You can register on any grid event
// executed before grid initialization
grid.on('before', function (grid) {});
// executed before launching any test on desired browser
grid.on('browser.before', function (browserRunner, desired) {});
// executed before every scenario
grid.on('scenario.before', function (scenarioRunner, desired) {});
grid.on('scenario.after', function (err, scenarioRunner, desired) {});
grid.on('browser.after', function (err, browserRunner, desired) {});
grid.on('after', function (err, grid) {});
// or do anything else you want, such as initialize your own reporter, launch a
// server...This project is released under MIT license.
Refer to the LICENCE file for more informations.
Some doc is available in the repository.

