WebDriver bindings for Node.js
One Tool To Rule Them All:
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. Creating
automated tests is as easy as:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| 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); }) .end();
|
Write your test specs with ES6 support!
If you are using Node.js (>=v0.11) or io.js you can write your test specs using yield
.
The wdio
test runner supports ES6 generators and allows you to get rid of nasty callback code.
1 2 3 4 5 6 7 8 9 10 11 12 13
| describe('my feature', function() { it('should do something', function *() { yield browser .url('https://duckduckgo.com/'); .setValue('#search_form_input_homepage', 'WebdriverIO') .click('#search_button_homepage'); var title = yield browser.getTitle(); console.log(title); }); });
|
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.
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.