watir安装备忘(Rubygem)
来源:互联网 发布:mac 查看系统版本 编辑:程序博客网 时间:2024/04/30 22:01
A
使用Watire可以获得页面上的各种元素,比如button,link...,然后你可以对这些元素进行操作
与网页交互(Interacting With a Web Page)
B
需要Ruby1.8.5
C
支持中文的话
要watir1.5.2
步骤如下:
1.打开watir.rb
2.在class TextField中加入一个新的method:
def characters_in(value)
index = 0
while index < value.length
len = value[index] > 128 ? 2 : 1
yield value[index, len]
index += len
end
end
3.更改class TextField的doKeyPress( value )方法部分代码,将下面代码
-------------------------------------------
for i in 0 .. value.length-1
sleep @container.typingspeed
c = value[i,1]
@container.log " adding c.chr " + c
@o.value = @o.value.to_s + c
@o.fireEvent("onKeyDown")
@o.fireEvent("onKeyPress")
@o.fireEvent("onKeyUp")
end
替换为如下代码
characters_in(value) {|c|
sleep @container.typingspeed
@o.value = @o.value.to_s + c
@o.fireEvent("onKeyDown")
@o.fireEvent("onKeyPress")
@o.fireEvent("onKeyUp")
}
- watir安装备忘(Rubygem)
- 修改RubyGem安装源
- 在Ubuntu12.04LTS上安装RubyGem
- 通过ruby-build安装ruby&rubygem环境
- [Watir]本地安装
- watir的本地安装
- Ruby+Watir安装
- [Ruby] Watir 安装教程
- ruby +watir +cucumber 安装
- Watir安装步骤
- ruby+watir 安装
- Ruby + Watir 安装使用步骤
- watir测试报告(一)
- watir测试报告(二)
- watir
- Rubygem 安装错误:ERROR: While executing gem ... (Gem::RemoteSourceException)
- RubyGem默认源安装太慢 302现象常现!
- RubyGem默认源安装太慢,修改国内淘宝源
- 快乐的生活 健康的过!
- Expected: class java.lang.Long, got class java.lang.Integer异常处理
- Spring框架发送Email
- 经典C++面试题
- 创建本月日期的文件夹2k-xp.bat
- watir安装备忘(Rubygem)
- PKU 1984 Navigation Nightmare dfs+并查集
- MRPQQ
- RedHat 5 vsftp 安装
- 经典sql语句写法,值得借鉴
- 金融危机为何没有压垮资本主义
- ORACLE 定时器JOB的有关说明
- java中equals方法和“==”的区别:(转)
- FPGA/CPLD入门介绍