Watir API介绍
文本框: <INPUTid="email" name="_fmu.u._0.e" value="" /> 方法1: ie.text_field(:id,'email').set("文本内容") 方法2: ie.text_field(:name, 'email').set("文本内容") 方法3: ie.text_field(:name,"email").clear下拉框: <SELECTname="c... « 阅读全文
ruby+watir的环境配置:
一、安装ruby:http://rubyforge.org/frs/?group_id=167.下载的rubyinstaller-1.9.2-p290.exe,(偶数为稳定版本)安装在F:/ruby192下,安装过程中会自动设置path路径。结束后再命令行中执行rubyCv查看安装是否成功。二、安装... « 阅读全文
watir控件识别
Watir是一个使用ruby实现的开源web自动化测试框架,相对于那些庞大的商业工具来说,它很小巧,也很灵活,提供的功能也足够用。Water提供了对多种常见的web对象的识别和操作的支持,例如hyperlinks的点击checkboxes的选中和清除,radio、buttons的选中和清除,下拉框和... « 阅读全文
学习ruby的问题总结
不知不觉两周过去了,这周用了大概一周的时间在学习ruby,掌握了一些基本的技巧和语法,下面简单总结下:一.如何看ruby的API的文档? 其实具体内容自己了解的也不是太多,但是这段学习教我学会如何去查找语法,如何使用API。 先说说API吧,我觉得ruby的API和QTP的API不同,rub... « 阅读全文
超简易Watir框架
比Ruby自带的Unit Test都简单……首先编写一个专门记录结果的类,可以根据自己的需要把结果输入到Excel或者数据库中。这个类主要有两个方法:记录结果,记录异常。例如类名:PutResult,方法名log,log_exception。然后把各个模块的脚本分别写在不同的脚本中,例如testsuite1.rb, testsuite2.rb, testsuite3.rb ...格式如下#File Name: testsuite1.rbrequire 'watir'if $t... « 阅读全文
Watir+Ruby:实例 5.创建动态方法
## This script creates any number of randomized Google phonebook searches,# then quickly cycles through each page of results, looking for server errors.# Written to reproduce and explore a bug that I found in the Google phonebook.#$LOAD_PA... « 阅读全文
Watir+Ruby: 对话框操作实例
require 'watir'require 'libAutoit.rb'require 'jcode'$KCODE = 'e'at = Autoit::AutoItApi.newwinClicker = WinClicker.newurl = "D:\\test.html"ie =Watir::IE.newie.goto(url)#~ ie.maximize()sleep(1)at.DealSecurity("watir处理对话框 - Windows Internet E... « 阅读全文
Parse Google Movie with Mechanize
require 'rubygems'require 'mechanize' require 'uri'require '/var/google_movie/html_helper'AGENT = ["Googlebot","Baiduspider"]PROXY = %w(59.36.100.186:8080 114.52.206.18:8080) CITY = %w(beijing shanghai shenzhen guangzhou) # 城市参数DATENUM... « 阅读全文
Watir:Excel文件打开数据读取
require 'win32ole' #打开excel文件excel = WIN32OLE.new("excel.application")excel.visible = truefilepath="D:\\code\\sky_ruby\\product\\lottery_port\\data\\登陆.xls" #路径用两斜杠workbook = excel.workbooks.open(filepath)worksheet=workbook.worksheets(1)#worksheet=w... « 阅读全文
Append text to text_field at watir
At watir we can submit texts to forms by such a code like : ie.text_field.set(), we could also append texts by the code such as ie.text_field.append(), following is an example:require ‘watir’include Watir# Initialize the text to be submitted to a... « 阅读全文

