WebDriverでChromeを起動するとUnable to find the chromedriver executableと怒られた

Selenium   Web Browser Automation

WebDriverでChromeを起動すると「Unable to find the chromedriver executable」と怒られてしまう。WebDriverを使ってChromeで画面テストしたいときは、chromedriverを設定しなければならない。


ソースはこんな感じ。

https://gist.github.com/daipresents/9a25d6b406cd3f3deb09f80616a54f02.js?file=gistfile1.txt

エラーメッセージはMacの場合こんな感じ。

https://gist.github.com/daipresents/9a25d6b406cd3f3deb09f80616a54f02.js?file=gistfile2.txt

chromedriverのページにいってドライバーをダウンロード、そしてPATHを通してねって書いてあるので分かりやすい。詳細は、ChromeDriverのWikiで確認可能。

あとはPATHを通してあげれば問題なく動作するはず。

https://gist.github.com/daipresents/9a25d6b406cd3f3deb09f80616a54f02.js?file=gistfile3.txt

WebDriverだとFirefoxよりChromeのほうが断然速くどうさする。1回のテストがUTより長くなるブラウザテストなので、この早さが結構重要になってくる。