A runner for selenium tests
Clone or download
Julien Muetton
Latest commit b197189 Oct 2, 2013


Selenium grid

Pilot a selenium grid from nodejs and run several scenarios in parallel.

Build Status


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-grid

via Git:

$ git clone https://github.com/themouette/selenium-grid.git && npm install


Add 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": "",
        "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"

Launch tests

$ node_modules/selenium-grid/bin/selenium-grid --recursive tests/functional

To 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:


// 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...

example output


This project is released under MIT license.

Refer to the LICENCE file for more informations.

Go further

Some doc is available in the repository.