Skip to main content
How to Get Started using WebdriverIO with Experitest
Last Updated Jul 08, 2020 — Continuous Testing Expert

How to Get Started using WebdriverIO with Experitest

Here is a step-by-step tutorial on how to install and run test scripts using WebriverIO.

The Continuous Testingcheat sheet

Here is a list of everything you need to do in order to build a mobile app test automation project that runs hands-free as part of your CI.

Get a copy
Continuous Testing is a mobile and browser test automation framework that has recently become quite popular in the software testing industry. This free and open-source framework is written in JavaScript and runs on Node.js. Packaged into npm, WebdriverIO is easy to install and use. This framework enables you to test web applications as well as native mobile apps.

Webdriver is popular because it is backed by Selenium which means you can run test scripts on all browsers. While it brings all the advantages of Selenium, it eliminates the pain of writing Java-based scripts. It allows you to easily integrate it with multiple testing frameworks such as Appium to bring the best out of both worlds.

WebdriverIO tutorial commands are simple and concise. The syntax is pretty clear. The wdio setup wizard walks you through the process of setting up your project. Using the Testrunner you can synchronously write asynchronous commands. Moreover, you can add hooks to perform a specific action during the test process. For instance, you can take a screenshot of an error message. The availability of a big community helps you to quickly resolve issues when you run into errors.

Here is a step-by-step tutorial on how to install and run test scripts using WebriverIO.

Step 1: Install Node.JS

To use  this WebDriverIO tutorial, you should have Node.js and Node Package Manager (npm) installed on your machine. When you install Node.js, npm automatically gets installed.

Visit Node JS website and download the latest LTS version. The current LTS version is 12.18.0 and the npm version is 6.14.4

download - WebdriverIO

Download the .msi file and install it.

setup - WebdriverIO

Click on Next and accept the license agreement.

setup - WebdriverIO

Choose the nodejs folder on the next screen.

setup - WebdriverIO

In the custom setup screen, you can customize the features to be installed.

setup - WebdriverIO

If you need additional tools for native modules, you can install them by checking the box in the native modules screen.

setup - WebdriverIO  

Click next to begin the installation process.

setup - WebdriverIO

Once the installation completes, click finish.

setup - WebdriverIO

To check if Node.js and npm are correctly installed on the machine, open the command prompt and type the following commands:

  • Node - v
  • Npm - v

command prompt - WebdriverIO

If Node.js and npm versions are displayed on the screen, it means the tools are ready to use.

Step 2: Create a Project Directory

Before beginning the project, create a project directory to organize all your project data into a single folder.

Open the command prompt and create a directory using the command mkdir.

  • mkdir experitestdemo

Now, navigate to that directory using the cd command

  • cd experitestdemo

Step 3: Create Package.JSON

Open the command prompt and type the following command:

  • npm init –y

Note: The –y parameter will create a default package.

Step 4: Install WebDriverIO command-line interface

To install WebDriverIO CLI, type the following command in the command prompt

  • npm install @wdio/cli

When the installation completes, it will display the details of the package added.

administrator - command prompt

Step 5: Create a WebDriverIO Config File

To execute test scripts using WebDriverIO, create a config file that contains the details of the tests, capabilities, and settings. To do so, enter the following command in the command prompt:

  • npx wdio config

administrator - command prompt

The wdio config wizard opens up. Provide the required details such as the automation backend, framework, reporting tool, etc.

  1. Where is your automation backend located? On my local machine ( When you want to run the tests in the cloud, you can specify the remote location here.)
  2. Which framework do you want to use? Mocha
  3. Synchronous or asynchronous? Sync
  4. Where are test specs located? Choose the default
  5. Which reporting tool to use? No
  6. Want to add a test service to setup? Chromedriver
  7. What is the base URL?

administrator - command prompt

It will display a message that the package is successfully installed and the configuration file is created successfully.

administrator - command prompt

Step 6: Create specs

Before proceeding with test execution, it is important to store all your test scripts in one place. So, create a directory ‘test' in the project folder, navigate to the test folder, and create a specs folder. Now create a javascript file in the specs folder and write your test script in that file and save it.

Here is an example javascript:

[javascript] describe(' page', () => { it('should have the right title', () => { browser.url('') const title = browser.getTitle() expect(browser).toHaveTitle('Experitest: Mobile App & Cross-Browser Testing End-to-End'); }) }) [/javascript]

Step 7: Execute your tests

To execute the test script, type the following command:

  • npx wdio wdio.conf.js

administrator - command prompt

The test script successfully launched the chrome browser, checked the title, and closed the browser.

administrator - command prompt

Now, the WebdriverIO is ready for use! So, write your scripts and run them instantly. Make sure to try a free trial of Experitest here.

Guy Arieli - CTO

More from the Blog

View more
May 13, 2022

What tips would you give testers on how to ask better questions?

Continuous Testing
The nature of testing is not about confirmation. It is about questioni ...
Read More
Mar 23, 2022 Continuous Testing, First in Market to Support Android 13 DP

Continuous Testing is proud to announce that our Continuous Testing solution i ...
Read More
Mar 21, 2022

Eliminate inefficiencies in your enterprise with codeless and continuous automated testing

Continuous Testing
Today, terms like codeless, continuous automated testing and shift lef ...
Read More
Feb 07, 2022

These key factors will help you choose an automation tool

Continuous Testing
The year 2022 looks to be another banner year of growth in the softwar ...
Read More
Contact Us