本文共 469 字,大约阅读时间需要 1 分钟。
今天任务不多,有空看了些watir的资料,于是手痒痒的想做个例子练练,网上有个google搜索的示例,本人也就照猫画虎,写了一个baidu搜索的小例子。大牛就直接跳过吧。。。欢迎有兴起的朋友一起交流学习,共进步。代码如下:
require 'watir'
context = "hello"
@broswer = Watir::IE.new @broswer.goto("") @broswer.text_field(:name,"wd").set(context) sleep 1 @broswer.button(:id,"su").click if @broswer.contains_text("#{context}") puts "Pass" else puts "Failed" end sleep(1) @broswer.close本文转自贺满博客园博客,原文链接:http://www.cnblogs.com/puresoul/archive/2011/12/06/2278291.html,如需转载请自行联系原作者。