Ruby Watir自动化环境搭建
来源:互联网 发布:sql默认实例 编辑:程序博客网 时间:2024/05/22 10:39
一、Ruby安装
1、下载最新版的Ruby安装程序:rubyinstaller-1.9.3-p194.exe
下载地址:http://rubyforge.org/frs/?group_id=167&release_id=46722
2、安装Ruby,安装完成后,位于C:\Ruby193
3、开始->运行->输入cmd回车,可以显示Ruby的版本,即Ruby安装成功。
二、RubyGems
1、>gem -v
显示:1.8.11
更新gem,用如下命令:
>gem update --system
2、>gem -v
显示:1.8.21
证明gem已更新成功
三、DevKit
Watir和watir-webdriver gems需要ffi gem, 还需要
RubyInstaller Development Kit (DevKit)
如果不安装DevKit,在安装Watir和Watir-Webdriver时会报错。
1、下载DevKit
下载地址:http://www.softpedia.com/progDownload/DevKit-Download-193050.html
2、安装DevKit,放在C盘devkit
3、在控制台,切换至devkit目录下
C:\devkit>ruby dk.rb init
[INFO] found RubyInstaller v1.9.3 at C:/Ruby193
Initialization complete! Please review and modify the auto-generated
'config.yml' file to ensure it contains the root directories to all
of the installed Rubies you want enhanced by the DevKit.
4、安装
C:\devkit>ruby dk.rb install
[INFO] Installing 'C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/defaults/operating_system.rb'
[INFO] Installing 'C:/Ruby193/lib/ruby/site_ruby/devkit.rb'
四、准备安装Watir和Watir-webdriver
1、在命令行输入命令
gem install watir
如果不想安装Watir的帮助文档,就用下面的命令
gem install watir --no-ri --no-rdoc
(...)
Successfully installed watir-2.0.4
(...)
安装成功后,可以测试是否能够在IE执行
>irb
> require "watir"
=> true
> browser = Watir::Browser.new
=> #<Watir::IE:0x..f8169d746 url="about:blank" title="">
> browser.goto "watir.com"
=> 16.998912
五、watir-webdriver
>gem install watir-webdriver --no-ri --no-rdoc
...)
Successfully installed watir-webdriver-0.4.1
(...)
在命令行验证是否能跑起来
>irb
> require "watir-webdriver"
=> true
> browser = Watir::Browser.new :ie
Selenium::WebDriver::Error::NoSuchDriverError: Unexpected error
launching Internet Explorer. Protected Mode must be set to the
same value (enabled or disabled) for all zones.
(...)
可以驱动Firefox吗?可以
>irb
> require "watir-webdriver"
=> true
> browser = Watir::Browser.new :ff
=> #<Watir::Browser:0x62d8c4a6 url="about:blank" title="">
> browser.goto "watir.com"
=> "http://watir.com/"
Chrome with watir-webdriver
>irb
> require "watir-webdriver"
=> true
> 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.
(...)
Watir-webdrirver API
http://rubydoc.info/gems/watir-webdriver/0.1.8/frames
1、下载最新版的Ruby安装程序:rubyinstaller-1.9.3-p194.exe
下载地址:http://rubyforge.org/frs/?group_id=167&release_id=46722
2、安装Ruby,安装完成后,位于C:\Ruby193
3、开始->运行->输入cmd回车,可以显示Ruby的版本,即Ruby安装成功。
二、RubyGems
1、>gem -v
显示:1.8.11
更新gem,用如下命令:
>gem update --system
2、>gem -v
显示:1.8.21
证明gem已更新成功
三、DevKit
Watir和watir-webdriver gems需要ffi gem, 还需要
RubyInstaller Development Kit (DevKit)
如果不安装DevKit,在安装Watir和Watir-Webdriver时会报错。
1、下载DevKit
下载地址:http://www.softpedia.com/progDownload/DevKit-Download-193050.html
2、安装DevKit,放在C盘devkit
3、在控制台,切换至devkit目录下
C:\devkit>ruby dk.rb init
[INFO] found RubyInstaller v1.9.3 at C:/Ruby193
Initialization complete! Please review and modify the auto-generated
'config.yml' file to ensure it contains the root directories to all
of the installed Rubies you want enhanced by the DevKit.
4、安装
C:\devkit>ruby dk.rb install
[INFO] Installing 'C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/defaults/operating_system.rb'
[INFO] Installing 'C:/Ruby193/lib/ruby/site_ruby/devkit.rb'
四、准备安装Watir和Watir-webdriver
1、在命令行输入命令
gem install watir
如果不想安装Watir的帮助文档,就用下面的命令
gem install watir --no-ri --no-rdoc
(...)
Successfully installed watir-2.0.4
(...)
安装成功后,可以测试是否能够在IE执行
>irb
> require "watir"
=> true
> browser = Watir::Browser.new
=> #<Watir::IE:0x..f8169d746 url="about:blank" title="">
> browser.goto "watir.com"
=> 16.998912
五、watir-webdriver
>gem install watir-webdriver --no-ri --no-rdoc
...)
Successfully installed watir-webdriver-0.4.1
(...)
在命令行验证是否能跑起来
>irb
> require "watir-webdriver"
=> true
> browser = Watir::Browser.new :ie
Selenium::WebDriver::Error::NoSuchDriverError: Unexpected error
launching Internet Explorer. Protected Mode must be set to the
same value (enabled or disabled) for all zones.
(...)
可以驱动Firefox吗?可以
>irb
> require "watir-webdriver"
=> true
> browser = Watir::Browser.new :ff
=> #<Watir::Browser:0x62d8c4a6 url="about:blank" title="">
> browser.goto "watir.com"
=> "http://watir.com/"
Chrome with watir-webdriver
>irb
> require "watir-webdriver"
=> true
> 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.
(...)
Watir-webdrirver API
http://rubydoc.info/gems/watir-webdriver/0.1.8/frames
- Ruby Watir自动化环境搭建
- 【ruby】windows自动化watir开发环境搭建
- Ruby+watir自动化测试环境搭建
- Ruby+watir自动化测试环境搭建
- ruby watir 网页自动化控制环境搭建及相关下载
- 在个人电脑上搭建Ruby+Watir自动化测试环境
- Ruby+Watir搭建自动化测试框架
- Windows环境搭建Web自动化测试框架Watir(基于Ruby)
- 搭建ruby+watir-webdriver+cucumber环境
- Ruby+Watir自动化测试
- 【Ruby+Watir测试框架系列讲座 1】基础环境搭建
- windows 系统下ruby +watir(firewatir)环境搭建
- Windows环境搭建Web自动化测试框架Watir
- Ruby+Watir的环境配置
- ruby+watir的环境配置:
- cucumber+watir+ruby 自动化测试-1
- watir学习之旅(二):搭建Ruby集成开发环境
- Ubuntu Linux 11.04ruby&watir运行环境
- 乱谈企业化信息规划与实施
- Java基础21-TCP
- objective-c 中使用了sqlite数据库。字段定义为boolean型的处理方法
- listview的用法
- 栈和队列
- Ruby Watir自动化环境搭建
- 解决SSL网页提示的不安全信息
- stdafx.cpp"编译引起的C2859、C1083、LNK2001错
- GridReport 5.0 报表的使用
- Launchpad Capacitive Sensing
- OpenGIS相关概念和开源软件
- .NET保护图片防盗链技术思路
- 关于thinkpad t400 安装Ubuntu 12.04 后的几个问题
- Thread interrupt() 方法的使用