Install
You will need to have Node.js and NPM installed on your machine. Check out their project websites for more instructions. If you want to have WebdriverIO integrated into your test suite, then install it locally with:
1
| $ npm install webdriverio --save-dev
|
The test runner is called wdio
and should be available after the install was successful:
1
| $ ./node_modules/.bin/wdio --help
|
You can also install the package globally on your machine and use the wdio
directly from the command line. However it is recommended to install it per project.
Set up your Selenium environment
There are two ways of setting up your Selenium environment: as a standalone package or by installing the
server and browser driver separately.
Use of existing standalone package
The simplest way to get started is to use one of the NPM selenium standalone
packages like: vvo/selenium-standalone. After installing
it (globally) you can run your server by executing:
1
| $ selenium-standalone start
|
If you are using the wdio testrunner you might be interested in the Selenium Standalone Service that starts the server for you everytime before the test starts.
You can also run the selenium server separately from your test setup. To do so you need to get the newest version of the selenium standalone server here. Just download the jar file somewhere on your system. After that start your terminal and execute the file via
1
| $ java -jar /your/download/directory/selenium-server-standalone-3.0.1.jar
|
With the latest version of Selenium most of the drivers for the browser come with an external driver that has to be downloaded and setup.
Setup Chrome
The Chromedriver is a standalone server which implements WebDriver’s wire protocol for Chromium. It is being developed by members of the Chromium and WebDriver team. For running Chrome browser tests on your local machine you need to download ChromeDriver from the project website and make it available on your machine by setting the PATH
to the ChromeDriver executable.
Setup Firefox
The same applies for Firefox. It is driven by the GeckoDriver that translates calls into the Marionette automation protocol. To run tests on Firefox with Selenium standalone server v3 or newer you also need to download the latest driver here and make it available in the PATH
of your machine.