The typescript typings for WebdriverIO.
typings install npm~webdriverio -S
/// <reference path="../typings/index.d.ts"/>
import webdriverio = require('webdriverio');
import {Browser} from 'webdriverio';
let options: any = {{ desiredCapabilities: { browserName: 'chrome' }};
let browser: Browser<any> = webdriverio.remote(options)
.init()
.url('http://webdriver.io/')
.getTitle()
.then((title: string) => {
console.log('Title was: %s', title);
})
.end();
typings install env~webdriverio -GS
NOTE: Following example is written using mocha framework.
/// <reference path="../typings/index.d.ts"/>
import assert = require('assert');
let browser = global.browser;
describe('webdriver.io page', function() {
it('should have the right title - the fancy generator way', function () {
browser.url('http://webdriver.io');
var title = browser.getTitle();
assert.equal(title, 'WebdriverIO - Selenium 2.0 javascript bindings for nodejs');
});
});
npm install
cd test
typings install
Open a separate terminal and start selenium standalone server
node_modules/.bin/selenium-standalone start
Run test
node_modules/.bin/mocha test/standalone/test.js
Running examples in mocha framework
cd test/wdio/mocha
../../../node_modules/.bin/wdio
Running examples in cucumber framework
cd test/wdio/cucumber
../../../node_modules/.bin/wdio
WDIO mode examples using mocha
For WDIO mode examples using cucumber, see examples under ./test/wdio/cucumber
MIT