今天任务不多,有空看了些watir的资料,于是手痒痒的想做个例子练练,网上有个google搜索的示例,本人也就照猫画虎,写了一个baidu搜索的小例子。大牛就直接跳过吧。。。欢迎有兴起的朋友一起交流学习,共进步。代码如下:

require 'watir'

context = "hello" 
@broswer = Watir::IE.new
@broswer.goto("http://www.baidu.com/")
@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 

相关文章:

  • 2021-11-14
  • 2021-09-23
  • 2021-09-20
  • 2021-08-14
  • 2022-12-23
  • 2021-08-25
  • 2022-01-30
猜你喜欢
  • 2022-01-04
  • 2022-01-15
  • 2021-12-02
  • 2021-10-01
  • 2021-04-26
  • 2021-11-22
相关资源
相似解决方案