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]FinderでMarkdown(md)形式のファイルをプレビューしたい

QuickLookを使うとアプリを起動しなくてもファイルの内容をプレビューできるので「テキストファイルの内容をちょっと見たい」といった時に非常に便利です。

[mac]iPadをサブディスプレイ化するDuet Displayを使おうとしたら初期設定にハマった話

iPad外部ディスプレイ化の新本命「Duet Display」公開 : ギズモード・ジャパン

[Mac]『入門Chef Solo』を読んで試してみた

伊藤直也さんの『 入門Chef Solo』を読んで、実際にVagrantを使って試してみた。

[mac]Karabinerでキーボード設定を便利にする(キーリピート、USキーボードの日本語切り替え)

以前は「KeyRemap4MacBook」という名前でしたがいつの間にか「Karabiner」に名前が変わっていました。