华丽的外出good电影:如何安装和使用RAutomation
来源:百度文库 编辑:偶看新闻 时间:2024/10/05 14:52:35
如何安装和使用RAutomation
今天在本地的gem list中发现了1个叫做rautomation的扩展,仔细一看原来这是个使用watir的语法进行windows程序测试的工具库,不敢独享,略志一二。
首先看一下rautomation的简介
RAutomation is a small and easy to use library for helping out to automate windows and their controls for automated testing. RAutomation是个小巧易用的工具库,其主要用来进行windows窗体和控件的自动化测试工作。
RAutomation的特点
- Easy to use and user-friendly API (inspired by Watir http://www.watir.com) 易用的watir like API
- Cross-platform compatibility 跨平台
- Easy extensibility - with small scripting effort it's possible to add support for not yet supported platforms or technologies 易扩展
RAutomation的用法
require "rautomation"# 通过匹配部分标题来获取窗口window = RAutomation::Window.new(:title => /part of the title/i)window.exists? # => truewindow.title # => "blah blah part Of the title blah"window.text # => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ultricies..."# 控件操作window.text_field(:class => "Edit", :index => 0).set "hello, world!"button = window.button(:text => "&Save")button.exists? # => truebutton.click# 获取当前所有窗口的句柄all_windows = RAutomation::Window.windowsall_windows.each {|window| puts window.hwnd}# 根据标题匹配所有窗口window = RAutomation::Window.new(:title => /part of the title/i)windows = window.windowsputs windows.size # => 2windows.map {|window| window.title } # => ["part of the title 1", "part of the title 2"]window.windows(:title => /part of other title/i) # => all windows with matching specified title# 遍历窗口上所有的button控件window.buttons.each {|button| puts button.value}window.buttons(:value => /some value/i).each {|button| puts button.value}# 使用autoit adapter来定位和操作窗口# 注意:需要注册AutoitX的DLLwindow2 = RAutomation::Window.new(:title => "Other Title", :adapter => :autoit) # use AutoIt adapter# 使用autoit的原生方法来操作控件# use adapter's (in this case AutoIt's) internal methods not part of the public API directlywindow2.WinClose("[TITLE:Other Title]")
RAutomation的安装
安装了watir 1.9后该扩展自动安装。另外也可以使用下面的命令进行安装
gem install rautomation
如何安装和使用网络电话?
如何安装和使用木马?
landesk如何安装和使用
如何安装ghost和如何使用ghost?
ghost如何安装和使用?要详细!
cs机器人如何安装和使用
清华紫光A600扫描仪如何安装和使用???
VM虚拟系统如何安装和使用!
如何安装、使用trados?
摄像头如何安装使用?
如何安装使用软件?
小蒙恬如何安装使用?
oekaki如何安装使用?
麦珈啡杀毒软件如何安装和使用?(下载完了)
有人用过AUTOMATION GATEWAY吗?如何安装和使用?
xp中如何限制来宾用户使用和安装软件
xp中如何限制其它用户使用和安装软件
xp中如何限制来宾用户使用和安装软件
Macromedia Flash player8.0如何安装和使用?
如何在XP下安装和使用UCDOS7.0
60g便携式seagate移动硬盘如何安装和使用.
如何在XP下安装和使用IIS6.0
如何使用服务器广播式安装windows和其它软件
请问大家如何安装和使用ghost啊?