Getting Started
Load the Watir library
Open a browser (default: Internet Explorer)
browser = Watir::Browser.new
Open Browser at the specified URL
browser = Watir::Browser.start("http:)
Go to a specified URL
Close the browser
Access an Element
Text box or text area
t = browser.text_field(:name, "username")
Button
b = browser.button(:value, "Click Here")
Drop down list
d = browser.select_list(:name, "month")
Check box
c = browser.checkbox(:name, "enabled")
Radio button
r = browser.radio(:name, "payment type")
Form
f = browser.form(:name, "address")
f = browser.form(:action, "submit")
Link
l = browser.link(:url, "http:)
l = browser.link(:href, "http:)
Table cell in a table (2nd row, 1st column)
td = browser.table(:name, 'recent_records')[2][1]
Check the Contents
Return the html of the page or any element
Return the text of the page or any element
Return the title of the document
|
Browser options (IE only)
Speed up execution
(or use the "-b" command line switch)
Maximize browser window
Pop browser window to front
Manipulate the Element
Click a button or link
Enter text in a text box
Enter multiple lines in a multi-line text box
Set radio button or check box
Clear an element
Select an option in a drop down list
d.select "cash"
d.set "cash"
Clear a drop down list
Submit a form
Flash any element (useful from the watir-console)
Get text from status bar.
Return true if the specified text appears on the page
browser.text.include? 'llama'
Return the contents of a table as an array
browser.table(:id, 'recent_records').to_a
分享到:
相关推荐
watir测试框架介绍 watir测试框架介绍 watir测试框架介绍
安装命令:gem install watir --local。
I am not sure when this started to occur, but the documentation on the site is lacking. answer: 3 down vote accepted On Windows XP (Professional, Version 2002, Service Pack 3, fully pathched) I ...
Firefox下载地址:http://www.hacker.cn/Get/gjrj/06102608545293311.shtml,建议装2.0 Gem下载地址:http://rubyforge.org/frs/?group_id=104&release_id=28016,建议装:rubygems-update-1.3.4.gem Firefox插件...
Firefox下载地址:http://www.hacker.cn/Get/gjrj/06102608545293311.shtml,建议装2.0 Gem下载地址:http://rubyforge.org/frs/?group_id=104&release_id=28016,建议装:rubygems-update-1.3.4.gem Firefox插件...
watir语法的详细介绍和描述,适合watir初学者。
watir介绍及安装
Watir测试框架介绍、环境配置、API介绍
该文档比较详细地介绍了自动化测试工具watir
watir-cn中文语言包 watir-cn中文语言包 watir-cn中文语言包 watir-cn中文语言包 watir-cn中文语言包 watir-cn中文语言包 watir-cn中文语言包 watir-cn中文语言包 watir-cn中文语言包 watir-cn中文语言包 watir-cn...
Watir 是一个使用 Ruby 实现的开源Web 自动化测试框架,相对于那些庞大的商业工具来说,它很小巧,也很灵活,提供的功能也足够用。最近抽时间试用了一下,感觉还不错,准备下一步在公司推广使用。因为 Watir 的网站...
公司自动化测试培训ppt,使用语言ruby,自动化测试工具watir,讲解基础api和常用框架
watir的api文档,可以离线查阅! chm格式。
Watir全称是“Web Application Testing in Ruby”,发音类似“water”。它是一种基于网页模式的自动化功能测试工具。 Watir是一个Ruby库,使用多版本浏览器进行Web应用程序测试。
压缩包中包含目前2013/01/19最新的安装文件,有rubyinstaller-1.9.2-p136、DevKit-tdm-32-4.5.1-20101214-1400-sfx、rubygems-1.8.24、watir-4.0.2、watir-webdriver-0.6.2等文件,并附上简略安装说明。
Watir图文教程 ppt材料 全英文 但是很容易看懂
2.本地安装watir-1.4.1.gem,执行gem install watir-1.4.1.gem -l 3.本地安装rubygems-update-1.3.4.gem,执行 gem install rubygems-update-1.3.4.gem 4.更新rubygems,执行update_rubygems (这一步先忽略,有影响...