Skip to main content

Webdriver.IO Integration - Selenium

Create a test file in your project, for example test/specs/myTest.js, and add the following sample content:

myTest.js example

const assert = require('assert');

describe('webdriver.io page', () => {
it('should have the right title', async () => {
await browser.url('https://digital.ai/continuous-testing');
const title = await browser.getTitle();
assert.strictEqual(title, 'Digital.ai Testing | Scalable App & Device Testing Tool');
});
});

For more advanced capabilities supported by Digital.ai Testing, see Selenium supported commands and grid execution.

wdio.config.js example

exports.config = {
runner: 'local',
hostname: '<cloud-ip>',
protocol: 'https',
port: 443,
path: '/wd/hub',

specs: [
'./test/specs/**/*.js'
],
capabilities: [{
'experitest:accessKey': '<AccessKey>', // Or userName, password and projectName if needed
platformName: 'windows', // Optional
browserVersion: 'latest', // Optional
browserName: 'firefox', // Optional
'experitest:testName': 'Selenium WebdriverIO test' // Optional
}],

mochaOpts: {
ui: 'bdd',
timeout: 60000
}
};

WebdriverIO run

To run your tests, use the appropriate command from a command line window:

  • Windows: npx wdio run .\wdio.conf.js
  • macOS: npx wdio run ./wdio.conf.js