# Install
Init package,
```
cd /path/to/app
npm init
```
Install webdriverio,
```
npm i --save-dev webdriverio
```
Install selenium standalone server,
```
npm i --save-dev selenium-standalone
```
Install latest browser drivers,
```
./node_modules/.bin/selenium-standalone install
```
Install mocha,
```
npm i --save-dev mocha
```
Create the tests folder
```
mkdir -p ./test/specs
```
# Configuration
Configure webdriver,
```
./node_modules/.bin/wdio config
```
Prompt answers,
```
? Where do you want to execute your tests? On my local machine
? Which framework do you want to use? mocha
? Shall I install the framework adapter for you? Yes
? Where are your test specs located? ./test/specs/**/*.js
? Which reporter do you want to use? dot
? Do you want to add a service to your test setup?
? Level of logging verbosity? error
? In which directory should screenshots gets saved if a command fails? ./errorShots/
? What is the base url? http://localhost
```
# Test webdriverio is working
Create a quick node test file,
```
touch ./wdtest.js
```
Create `wdtest.js` with following content,
```
var webdriverio = require('webdriverio');
var options = {
desiredCapabilities: {
browserName: 'chrome'
}
};
webdriverio
.remote(options)
.init()
.url('http://www.google.com')
.getTitle().then(function(title) {
console.log('Title was: ' + title);
})
.end();
```
Open terminal window and start `selenium-standalone`,
```
cd /path/to/app
./node_modules/.bin/selenium-standalone start
```
Open another terminal window,
```
cd /path/to/app
node ./wdtest.js
```
# Test mocha is working,
Create test spec,
```
touch ./test/specs/spec.js
```
Create `spec.js` with following content,
```
//spec.js
describe("First Spec", function () {
it("should load the webdriverio homepage", function () {
return browser.url("http://webdriver.io/")
.getUrl().then(function(url) {
console.log(url);
});
});
})
```
Open terminal window and start `selenium-standalone`,
```
cd /path/to/app
./node_modules/.bin/selenium-standalone start
```
Open another terminal window and run the mocha test suite,
```
cd /path/to/app
./node_modules/.bin/wdio wdio.conf.js
```