Testing with Chrome - MattiSG/Watai GitHub Wiki
To test with Chrome, you will need to install another utility, chromedriver, to bridge the Selenium server to Google Chrome.
brew install chromedriver
- Download the proper precompiled version for your platform from ChromeDriver’s downloads.
- Make the downloaded file executable (
chmod a+x path/to/chromedriver). - Place the downloaded executable in your
PATH(mv path/to/chromedriver /usr/local/binfor example, for Unices), or set thewebdriver.chrome.driversystem property to the path of the executable.
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".
// config.json
{
"baseURL": "http://127.0.0.1:3000",
"browser": "chrome"
}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.
// config.json
{
"driverCapabilities": {
"chromeOptions": { "binary": "/path/to/Google Chrome" },
}
}For example, if you installed Chrome with brew cask:
// ~/.watai/config.json
{
"driverCapabilities": {
"chromeOptions": {
"binary": "/opt/homebrew-cask/Caskroom/google-chrome/latest/Google Chrome.app/Contents/MacOS/Google Chrome",
}
}
}- Much faster browser start than Firefox, and faster browsing mean faster tests.
- Obviously, testing on Chrome, a rather common browser ;)
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.