Using Watai with Google Chrome
==============================

To test with Chrome, you will need to install another utility, `chromedriver`, to bridge the Selenium server to Google Chrome.


Installation
------------

### Under OS X with Homebrew

    brew install chromedriver

### Others

1. Download the proper precompiled version for your platform from [ChromeDriver’s downloads](http://code.google.com/p/chromedriver/downloads/list).
2. Make the downloaded file executable (`chmod a+x path/to/chromedriver`).
3. Place the downloaded executable in your `PATH` (`mv path/to/chromedriver /usr/local/bin` for example, for Unices), or set the `webdriver.chrome.driver` system property to the path of the executable.


Choosing Chrome as the target browser
-------------------------------------

Edit the `config` of your Watai test suite.

You will have to set the `browser` key (or the `browserName` key of the `driverCapabilities` hash) to `"chrome"`.

```json
// config.json
{
    "baseURL": "http://127.0.0.1:3000",
    "browser": "chrome"
}
```

### Non-standard binary location

If your Chrome browser is not in its default installation location (i.e. you moved it after having installed it, or you installed it with a package manager), you will also need to give the path to its _binary_ in the `chromeOptions` object of the `driverCapabilities` hash.

```json
// config.json
{
    "driverCapabilities": {
        "chromeOptions": { "binary": "/path/to/Google Chrome" },
    }
}
```

For example, if you installed Chrome with `brew cask`:

```json
// ~/.watai/config.json
{
    "driverCapabilities": {
        "chromeOptions": {
            "binary": "/opt/homebrew-cask/Caskroom/google-chrome/latest/Google Chrome.app/Contents/MacOS/Google Chrome",
        }
    }
}
```


Benefits
--------

1. _Much_ faster browser start than Firefox, and faster browsing mean faster tests.
2. Obviously, testing on Chrome, a rather common browser  ;)


Limitations
-----------

### Runaway processes

Even though Watai does its best to clean up after itself, there may be cases where the `chromedriver` process is not killed properly. After a set of testing sessions, you should therefore make sure no runaway processes are left, with `killall chromedriver`, for example.
