WebdriverIO is a ‘npm’ package and runs on ‘Node.js‘. So, we need to install ‘Node.js’ and ‘npm’ in our machine before installing WebdriverIO.
If you want to have WebdriverIO integrated into your test suite, then install it globally with:
npm install -g webdriverio
Create your project folder in your desired location.
Note: Assuming ‘WebdriverIOAutomation’ is the project name.
There are two approaches to configure our project for WebdriverIO. We have explained both the approaches below. You can follow either one of them. First approach is to use default test runner of WebdriverIO. Second approach is for writing tests without any test runner. We recommend to go with Approach1
Approach1: With default test runner and testing framework
- Configuring project with wdio configurator.
- Webdriverio is configured and ready to use. Now, it’s time to write first test script.
Approach2: Without default test runner/testing framework
We need to have selenium server to run webdriver IO tests. There are many node-modules available to download and selenium server in our machine. ‘selenium-standalone’ node_module is the simple one to use.
Run below command to install ‘selenium-standalone’.
npm install -g selenium-standalone
Run the below command to download latest selenium-server-standalone and other browser drivers like ChromeDriver and GeckoDriver etc..
Setup is completed for Approach2. Now it’s time to write first program without default test runner/unit test framework.