DEV Community

Nishant Ranjan
Nishant Ranjan

Posted on

What is WebdriverIO?

WebdriverIO is a custom implementation for selenium's W3C webdriver API. It is written in Javascript and packaged into 'npm' and runs on Node.js.


Main Features of WebdriverIO:

  • WebdriverIO is a good automation tool which can automate both web applications and native mobile Apps.
  • It has integrated test runner which helps us to write asynchronous commands in a synchronous way so that we don’t need to care about how to handle a Promise to avoid racing conditions.
  • It has 'wdio setup wizard' which makes our project setup very easy.
  • We can write our own javascript functions test.
  • The test runner also comes with a variety of hooks that allow us to interfere into the test process in order to e.g. take screenshots if an error occurs or modify the test procedure according to a previous test result.
  • WebdriverIO services will be helpful to integrate our test to third party tools like 'Appium'.

Installation steps:

To install webdriverIO, you will need node to be installed in your system. Please go through below mentioned post to install it.

Install node in mac and windows

  • Setup your project Before installing dependencies, we will need to initialize a new NPM project. This will allow us to use the CLI to install dependencies in your project.
$ mkdir webdriverio-test && cd webdriverio-test
$ npm init -y
Enter fullscreen mode Exit fullscreen mode

The -y will answer 'yes' to all the prompts, giving you a standard NPM project. Feel free to omit the -y if you'd like to specify your own project details.

  • Install WebdriverIO CLI
$ npm i --save-dev @wdio/cli
Enter fullscreen mode Exit fullscreen mode
  • Generate configuration file Next, we will generate a configuration file to store our WebdriverIO settings.

To do that, just run the configuration utility:

$ npx wdio config -y
Enter fullscreen mode Exit fullscreen mode

That's it! The configurator will install all required packages for you and create a config file called wdio.conf.js.

In next post we will run our first spec using webdriverIO.

Thanks for reading. Please share your thoughts.

Top comments (0)