hello-world
webエンジニアのメモ。とりあえずやってみる。

[mac][ruby]seleniumでchromeを使用する

公開日時

rubyでselenium-webdriverを使ってchromeを起動しようとしたら以下のようなエラーが

`executable_path': Unable to find the chromedriver executable. Please download the server from http://chromedriver.storage.googleapis.com/index.html and place it somewhere on your PATH. More info at http://code.google.com/p/selenium/wiki/ChromeDriver. (Selenium::WebDriver::Error::WebDriverError)

seleniumでchromeを起動するには別途 Chrome Driver をダウンロードして来る必要があるようです

上記のダウンロードページから「chromedriver_mac32.zip」をダウンロードし、適当なディレクトリに解凍

今回はrubyスクリプトと同じ場所に設置しました シンボリックリンクを作成

ln -s $HOME/selenium-sample/chromedriver /usr/local/bin/chromedriver

スクリプトに

require 'selenium-webdriver'

driver = Selenium::WebDriver.for(:chrome)

と記述すればchromeを立ち上げることができます

参考


Related #mac

macを買ったらとりあえずファンクションキーの動作を変更する

昨日に続きまして、macを買ったらとりあえず変更しておきたいキーボード設定です。

Web制作から日常使用まで、とりあえず入れている便利なChrome拡張一覧

最近、Macを新しくセットアップし直す機会があったので、Chrome拡張も整理してみました。