多思考,多实践,现状才会改变!

部署linux(ubuntu11.04) 中ruby&watir运行环境

上一篇 / 下一篇  2011-11-11 11:50:45 / 个人分类:部署ruby watir运行环境

 Ubuntu Linux 11.04ruby&watir运行环境:

Step 1.Ruby安装

$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-update
Successfully installed rubygems-update-1.3.7
再执行update_rubygems更新命令:
$sudo /var/lib/gems/1.8/bin/update_rubygems
RubyGems installed the following executables:/usr/bin/gem1.8

Step4.watir-webdriver安装(支持iefirefox,chromeand Opera)
$sudo gem install watir-webdriver --no-ri --no-rdoc
(...)
Successfully installed watir-webdriver-0.2.8
4 gems installed
Let'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 = Watir::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=> #<Watir::Browser:0x..fb6fb4f80 url="about:blank" title="">
irb(main):004:0> browser.goto('www.google.com')
=> "http://www.google.com.hk/"

Note:
If you want to use chrome,you should install chrome first.You do this:
browser = Watir::Browser.new :chrome
if you use ie or Opera, do this:
browser = Watir::Browser.new :ie
browser = Watir::Browser.new :opera
Start your script!


TAG: firewatir Linux Ruby ruby Ubuntu ubuntu Watir watir watir-webdriver

引用 删除 me_xiaoyu0420   /   2012-02-20 13:13:50
你好,请教你一个问题吧,希望能不吝赐教哈

watir写测试脚本。textear多行文本框无法输入内容。可以帮我解决下吗。
 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

Open Toolbar