现在的位置: 首页 > 综合 > 正文

HelloWorld – Watir

2013年08月09日 ⁄ 综合 ⁄ 共 759字 ⁄ 字号 评论关闭

今天看了一下Watir的相关内容,写了个HelloWorld。

 

Watir is a testing tool for automating browser-based tests of web applications. It is a Ruby library that works with Internet Explorer and Firefox.

 

http://rubyforge.org/projects/wtr/

 

目前最新版本是:watir1.6.5 November 10, 2009

 

 

watir的安装不是很容易,下面是成功安装的方法:

1、下载并安装这个ruby安装包:

http://rubyforge.org/frs/download.php/29263/ruby186-26.exe

 

2、下载并安装watir1.5.2

http://rubyforge.org/frs/download.php/24880/watir-1.5.2.gem

 

更新gem

gem update –system

 

去到watir1.5.2所在的目录,执行:

gem install watir-1.5.2.tar

 

 

编写一个HelloWorld.rb

 

require 'watir'
test_site = 'http://blog.csdn.net/testing_is_believing/'
# open the IE browser
ie = Watir::IE.new
# print some comments
puts "## Beginning of test"
puts "  "
puts "Step 1: go to the test site: " + test_site
ie.goto(test_site)
puts "  Action: entered " + test_site + " in the address bar."

 

尝试运行成功!

抱歉!评论已关闭.