WebdriverIO Example

WebdriverIO is supported by Gridlastic, run your tests in the cloud at blazing speed on real browsers. We also support other javascript frameworks like wd.js and Protractor AngularJS.

The Gridlastic hub endpoint and the video url used in this code example is displayed after launching your Gridlastic selenium grid. See documention Selenium Grid Configuration Parameters where to find these credentials and replace with your own.

Get a free account and launch your Gridlastic selenium grid, then run this code locally and test your grid!

var webdriverjs = require('webdriverio'),
    client = webdriverjs.remote({
        desiredCapabilities: {
            browserName: 'chrome',
            version: 'latest',
            platform: 'VISTA',
            platformName: 'windows',
            video: 'True'
			},
        host: 'SUBDOMAIN.gridlastic.com',
        port: 80,
        user: USERNAME,
        key: ACCESS_KEY
    }).init();

 
client
    .url('https://www.google.com/ncr')
    .setValue('*[name="q"]','webdriverio')
    .click('*[name="btnG"]')
    .pause(1000)
    .session(function(err,res) {
    console.log("Video: " + VIDEO_URL + res.value['webdriver.remote.sessionid']);
	})
    .end();
Note: starting from selenium version 3.9.1 you must also include "platformName": "windows" in the request when testing with firefox and IE.



NOTE: Gridlastic auto scaling requires all 3 test environment parameters platform, browser and browser version to be specified in each request in order to launch test nodes to fulfill test demand. Video recording is optional. See test environments for capabilities options.
It is important to ensure that ".end()" is always called for proper test execution and creation of video recordings of failed tests.