WebdriverIO

WebdriverI/O

Selenium 2.0 bindings for NodeJS

Build Status Coverage Status

One Tool To Rule Them All:

Grunt Integration Gulp Integration Sublime Text Plugin Visual Regression Testing with Applitools Eyes WebRTC Analytics Plugin

What is WebdriverIO?

WebdriverIO lets you control a browser or a mobile application with just a few lines of code. Your test code will look simple, concise and easy to read. The integrated testrunner allows you to write asynchronous commands in a synchronous way so that you don’t need to care about how to propagate a Promise to avoid racing conditions.

The test runner comes also with a variety of hooks that allow you to interfere into the test process in order to take screenshots if an error occurs or modify the test procedure according to a previous test result.
1
2
3
4
5
6
7
8
9
var assert = require('assert');

describe('webdriver.io page', function() {
it('should have the right title', function () {
browser.url('http://webdriver.io');
var title = browser.getTitle();
assert.equal(title, 'WebdriverIO - Selenium 2.0 javascript bindings for nodejs');
});
});

Get Started

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
var webdriverio = require('webdriverio');
var options = { desiredCapabilities: { browserName: 'chrome' } };
var client = webdriverio.remote(options);

client
.init()
.url('https://duckduckgo.com/')
.setValue('#search_form_input_homepage', 'WebdriverIO')
.click('#search_button_homepage')
.getTitle().then(function(title) {
console.log('Title is: ' + title);

// outputs:
// "Title is: WebdriverIO (Software) at DuckDuckGo"
})
.end();

WebdriverIO as standalone package

WebdriverIO was designed to be as flexible and framework agnostic as possible. It can be applied in any context and serves not the purpose of testing.

You can use WebdriverIO as scrapper tool to dynamically fetch website data in an automated way. You also can integrate WebdriverIO in your own automation library. Popular examples of that are Chimp or CodeceptJS.

Easy Test Setup

The wdio command line interface comes with a nice configuration utility that helps you to create your config file in less than a minute. It also gives and overview of all available 3rd party packages like framework adaptions, reporter and services and installs them for you.

WDIO configuration utility

How does it work?

WebdriverIO is an open source testing utility for nodejs. It makes it possible to write super easy selenium tests with Javascript in your favorite BDD or TDD test framework. Even Cucumber tests are supported.

It basically sends requests to a Selenium server via the WebDriver Wire Protocol and handles its response. These requests are wrapped in useful commands, which provide callbacks to test several aspects of your site in an automated way.

Run your tests in the cloud

Services like Sauce Labs or BrowserStack provide selenium testing on remote hosts. Be able to run tests on a wide collection of plattforms, devices and browser combinations without any configuration in your enviroment.

WebdriverIO supports services including:

Sauce Labs BrowserStack TestingBot