NodeJS and Selenium

By Jochen D.

Today we've added support for NodeJS Selenium testing on our Selenium grid. Installation of our plugin is easy by using NPM (Node Package Manager).


To install our plugin, please run: npm install testingbot


A simple example of a NodeJS test:

Copy code
var soda = require('soda')
, assert = require('assert');

var browser = soda.createTestingBotClient({
'url': 'http://www.google.com'
, 'os': 'Windows'
, 'browser': 'iexplore'
, 'browser-version': '8'
, 'max-duration': 300 // 5 minutes

});

// Log commands as they are fired

browser.on('command', function(cmd, args){
console.log(' \x1b[33m%s\x1b[0m: %s', cmd, args.join(', '));
});

browser
.chain
.session()
.setTimeout(8000)
.open('/')
.waitForPageToLoad(5000)
.getTitle(function(title){
assert.ok(~title.indexOf('Google'))
})
.end(function(err){
browser.testComplete(function() {
    if (err) throw err;
  });
});

To read more about our NodeJS plugin, please take a look at our support pages: https://testingbot.com/support/getting-started/nodejs.html


The repository of our NodeJS plugin is located on GitHub: https://github.com/testingbot/soda

Ready to start testing?

Start a free trial