不要追求绝对的公平,红尘之中没有公平而言,人活一世,难得糊涂。                                           it is no use doing what you like, you have got to like what you do.

针对popups类对话框的watir处理方法之三

上一篇 / 下一篇  2009-09-16 15:39:38 / 个人分类:ruby_watir

每日随笔
  • 每日随笔:
51Testing软件测试网N&qq^UD:E5} `c
针对该警示框的识别问题:51Testing软件测试网r#T0J7ljk
51Testing软件测试网;w5p"]&coJ)sE
这个比较简单点。。。51Testing软件测试网:T#Jz1TLb9G V#I{#S

n4H8f uhV]Y#};I0require 'watir'
(U}z)V*t$vi0require 'win32ole'
O1e_1D:eH3\ zF0require 'watir/WindowHelper'51Testing软件测试网vz.Q$r1L'`oiE
# 登陆51Testing软件测试网o7GR!at J6Wj
$ie_site ='http://members.shaw.ca/paul_rogers/watir_tests/popups1.html'
f RSE E3c0#$f = 'E:\WorkSpace\00-Automation\03_MOA\02_Branches\JiangXi\V2.9.1\Lib\db1.vbs'
[\*oarrw0$ie = Watir::IE.new51Testing软件测试网6@om}h:P m8H }
$ie.goto $ie_site
Sk \t0v8z(S0#$ie.buttons.each {|f| puts f.to_s}51Testing软件测试网mU1~s3?E KS
51Testing软件测试网Lr)F}2@1Rdl
$ie.button(:value,"Alert").click_no_wait
gM,sBj0sleep(7)
yv#vS@0autoit = WIN32OLE.new("autoitx3.control")51Testing软件测试网&kUu9}}uPdSu(B ]
$a = autoit.WinWait("Microsoft Internet Explorer","",1)
l Sp]'Yl W0puts $a51Testing软件测试网/{f:V~ g%dO~ q
$b = autoit.ControlGetText("Microsoft Internet Explorer","","Static2")51Testing软件测试网2}s{va
puts $b51Testing软件测试网!r#pu:U.Wc Y$k
$c = autoit.ControlClick("Microsoft Internet Explorer","确定","Button1")
:|$[)f4Dw&a"@$k0puts $c
DsI9B5C051Testing软件测试网9V-?\#[Z
$a $b ¥c 结果为1的时候 为通过~!51Testing软件测试网R? CF8t
相关函数用法:51Testing软件测试网t c Y~K w

U3`;{BJx0ControlGetText:
$YKI1p:m^^0ControlGetText ( "title", "text", controlID )51Testing软件测试网%z/t[+{ d
Function ControlGetTextSuccess: Returns text from a control.51Testing软件测试网r:`/Z'g)HS ?6o0u
Failure: Sets @error to 1 and returns a blank string of "".51Testing软件测试网JWg7h2{*y

5uY?5n(gL9mO#O yAp051Testing软件测试网6J i t tMd1|

TAG:

 

评分:0

我来说两句

Open Toolbar