11.04ruby&watir运行环境:
Step 1.安装
$sudo apt-get install ruby
查看是否安装成功:
$ ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]
Step 2. RubyGems安装(管理ruby包)
$sudo apt-get install rubygems1.8
查看是否安装成功:
$ gem -v
1.3.7
Step 3.更新gem update
如果直接使用命令sudo gem update –system,则会报错如下:
$ gem update –system
ERROR: While executing gem ... (RuntimeError)
gem update --system is disabled on Debian, because it will
overwrite the content of the rubygems Debian package......
解决方法:$sudo gem install rubygems-updateSuccessfully installed rubygems-update-1.3.7再执行update_rubygems更新命令:$sudo /var/lib/gems/1.8/bin/update_rubygemsRubyGems installed the following executables:/usr/bin/gem1.8Step4.watir-webdriver安装(支持ie,firefox,chromeand Opera)
$sudo gem install watir-webdriver --no-ri --no-rdoc(...)Successfully installed watir-webdriver-0.2.84 gems installedLet's check if it can drive Firefox :wdd@ubuntu:~$ irb
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'watir-webdriver'
=> true
irb(main):003:0>browser = ::Browser.new :ff
/usr/lib/ruby/gems/1.8/gems/selenium-webdriver- 2.13.0/lib/selenium/webdriver/common/platform.rb:129: warning: Insecure world writable dir /opt in PATH, mode 040777=> #irb(main):004:0> browser.goto('')
=> ""
Note:If you want to use chrome,you should install chrome first.You do this:browser = Watir::Browser.new :chromeif you use ie or Opera, do this:browser = Watir::Browser.new :iebrowser = Watir::Browser.new :operaStart your script!
阅读(3086) | 评论(0) | 转发(0) |