如何安装和使用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? # => true
window.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? # => true
button.click# 获取当前所有窗口的句柄
all_windows = RAutomation::Window.windows
all_windows.each {|window| puts window.hwnd}# 根据标题匹配所有窗口
window = RAutomation::Window.new(:title => /part of the title/i)
windows = window.windows
puts windows.size # => 2
windows.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的DLL
window2 = 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 directly
window2.WinClose("[TITLE:Other Title]")
RAutomation的安装
安装了watir 1.9后该扩展自动安装。另外也可以使用下面的命令进行安装
gem install rautomation
如何安装和使用RAutomation相关推荐
- linux环境下nacos的安装+启动,阿里云服务器安装nacos
nacos安装+启动(linux环境): 基础:安装java环境 官网下载压缩包:如 nacos-server-1.2.1.tar.gz 放在自定义目录下 # 解压 tar -xvf nacos-se ...
- Alibaba Cloud Linux 2.1903 LTS 64位服务器yum源下载404,Alibaba Cloud Linux 2实例中使用docker-ce、epel等YUM源安装软件失败
[Alibaba Cloud Linux 2.1903 LTS 64位]服务器yum源下载404 failure: repodata/repomd.xml from docker-ce-stable: ...
- Linux下docker安装配置oracle,oracle创建用户并远程连接,实测可用!
最近在给同学弄毕业设计的数据库,因为oracle在个人电脑上极不稳定,所以他的电脑数据库崩溃了,这时候我就在docker上为他拉了一个oracle,解决了问题. docker的安装共有以下几步,实测没 ...
- 在docker上安装部署tomcat项目 超简单,拿来主义
在docker中部署tomcat,非常简单,而且省去了手动安装jdk等步骤,只需要将war包复制在容器tomcat实例中的webapps下面即可.以下将详细讲解流程: 在windows中打好包以后用w ...
- docker一步安装mysql,docker的魅力就在于此
正常来说,使用docker安装东西的步骤是serach它有没有,然后pull它 这里其实只要一步(如果你没有安装过.没有端口占用等问题的话!!) $ docker run -d -p 3306:330 ...
- Linux下tomcat的安装与卸载以及配置(超简单)
无敌简单的几步 1.安装 //首先你需要下载好tomcat包 sudo tar -xvzf apache-tomcat-7.0.85.tar.gz(这里是包名) -C 你要放的位置 2.卸载 rm - ...
- Linux下安装Java8
Linux(ubuntu)下Java8安装 1.下载jdk8 这个看大家了,linux版本的就可以 2.创建jvm文件夹 在根目录下创建名为jvm的文件夹(在哪里创建看个人) $ sudo mkdir ...
- Linux安装mysql,一步到位!
今天在腾讯云上面买了一个服务器,想要把自己的项目部署一下,就要安装mysql,以下是我的安装步骤,在网上有很多人把install敲错了,还有的少-get,种种错误试完之后,我决定发一篇 sudo ap ...
- Maven安装与配置(最实用!!!)eclipse中配置maven
Maven安装与配置 一.需要准备的东西 JDK Eclipse(本章主要是在eclipse中进行配置maven) Maven程序包 二.下载与安装 1. 前往maven下载最新版的Maven程序: ...
最新文章
- 配置nginx,支持php的pathinfo路径模式
- 改镜像_镜像制作大法
- CSS布局解决方案(终结版)
- 用Java弹出创建新的消息通知
- mybaties总结+hibernate总结
- docker-compose安装elk7.1.1版本
- 用html编写你好,02 - HTML5第一个项目:HelloWorld!(收藏)
- SIGPIPE信号处理
- 什么是交换机?它有哪些作用?
- 同程艺龙解除合作,同程支付艺龙3000万补偿金
- 树莓派 Pico Pi USB串口通信
- Cousera - Machine Learning - 课程笔记 - Week 2
- selenium报错信息-- Python 中 ‘unicodeescape‘ codec can‘t decode bytes in position XXX: trun错误解决方案
- 一、Jmeter总结
- UE4 EQS C++自定义节点编写
- iOS开发 判断输入语言是否是汉语
- SDB光猫虚拟服务器,折腾光猫/路由器[MIPS架构](1):用Samba服务器搭建家庭文件共享中心...
- QT4.7.3交叉编译到ARM后,字体大小如何调整?
- android游戏开发实例-可局域网对战的飞行棋(三)
- 由DIY想到的面向对象思想
热门文章
- 什么叫做类数组对象?
- C语言 之建立静态链接库
- 分布式 Socket 通信
- 漫漫运维路——基于CentOS6平台软件包管理2
- SaltStack:Salt SSH
- yum安装zlib出错
- struts2+jquery之form插件实现异步上传图片并显示
- audio 上一首 下一首 自定义样式_我们的歌:盛典即将来临,勤深深还有一首歌,这场表演值得期待...
- thinkPHP5.1.9 vendor 第三方库的使用
- 在swt中获取jar包中的文件 uri is not hierarchical