2011年9月30日金曜日

Ruby + Watir

Watir でChromeを自動操作したいのだが

$ gem install watir-webdriver
Fetching: json_pure-1.6.1.gem (100%)
Fetching: rubyzip-0.9.4.gem (100%)
Fetching: ffi-1.0.9.gem (100%)
Building native extensions. This could take a while...
Fetching: childprocess-0.2.2.gem (100%)
Fetching: selenium-webdriver-2.7.0.gem (100%)
Fetching: watir-webdriver-0.3.4.gem (100%)
Successfully installed json_pure-1.6.1
Successfully installed rubyzip-0.9.4
Successfully installed ffi-1.0.9
Successfully installed childprocess-0.2.2
Successfully installed selenium-webdriver-2.7.0
Successfully installed watir-webdriver-0.3.4
6 gems installed
Installing ri documentation for json_pure-1.6.1...
Installing ri documentation for rubyzip-0.9.4...
Installing ri documentation for ffi-1.0.9...
Installing ri documentation for childprocess-0.2.2...
Installing ri documentation for selenium-webdriver-2.7.0...
Installing ri documentation for watir-webdriver-0.3.4...
Installing RDoc documentation for json_pure-1.6.1...
Installing RDoc documentation for rubyzip-0.9.4...
Installing RDoc documentation for ffi-1.0.9...
Installing RDoc documentation for childprocess-0.2.2...
Installing RDoc documentation for selenium-webdriver-2.7.0...
Installing RDoc documentation for watir-webdriver-0.3.4...
$ irb

ruby-1.9.2-p290 :001 > require 'watir-webdriver'
=> true
ruby-1.9.2-p290 :002 > browser = Watir::Browser.new(:chrome)
Selenium::WebDriver::Error::WebDriverError: Unable to find the chromedriver executable. Please download the server from http://code.google.com/p/chromium/downloads/list and place it somewhere on your PATH. More info at http://code.google.com/p/selenium/wiki/ChromeDriver.
from /home/nakamura/.rvm/gems/ruby-1.9.2-p290/gems/selenium-webdriver-2.7.0/lib/selenium/webdriver/chrome/service.rb:18:in `executable_path'
from /home/nakamura/.rvm/gems/ruby-1.9.2-p290/gems/selenium-webdriver-2.7.0/lib/selenium/webdriver/chrome/service.rb:28:in `default_service'
from /home/nakamura/.rvm/gems/ruby-1.9.2-p290/gems/selenium-webdriver-2.7.0/lib/selenium/webdriver/chrome/bridge.rb:12:in `initialize'
from /home/nakamura/.rvm/gems/ruby-1.9.2-p290/gems/selenium-webdriver-2.7.0/lib/selenium/webdriver/common/driver.rb:35:in `new'
from /home/nakamura/.rvm/gems/ruby-1.9.2-p290/gems/selenium-webdriver-2.7.0/lib/selenium/webdriver/common/driver.rb:35:in `for'
from /home/nakamura/.rvm/gems/ruby-1.9.2-p290/gems/selenium-webdriver-2.7.0/lib/selenium/webdriver.rb:81:in `for'
from /home/nakamura/.rvm/gems/ruby-1.9.2-p290/gems/watir-webdriver-0.3.4/lib/watir-webdriver/browser.rb:35:in `initialize'
from (irb):2:in `new'
from (irb):2
from /home/nakamura/.rvm/rubies/ruby-1.9.2-p290/bin/irb:16:in `
'
ruby-1.9.2-p290 :003 >

0 件のコメント:

コメントを投稿