不要追求绝对的公平,红尘之中没有公平而言,人活一世,难得糊涂。                                           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软件测试网:w!vb TQ2L9q0C/w4L
针对该警示框的识别问题:
*P9w+uL%J!?{:_]051Testing软件测试网(TSC U7xA
这个比较简单点。。。51Testing软件测试网q'_-|sn;p0e-l
51Testing软件测试网f&x dl b J8hx
require 'watir'
.~8HY)O/R#K0require 'win32ole'51Testing软件测试网5] ]"hSx dr+wVY\
require 'watir/WindowHelper'51Testing软件测试网+Q |V I0y qGe
# 登陆
&KlK!~V4w-a}0$ie_site ='http://members.shaw.ca/paul_rogers/watir_tests/popups1.html'51Testing软件测试网 as1D2Rd[
#$f = 'E:\WorkSpace\00-Automation\03_MOA\02_Branches\JiangXi\V2.9.1\Lib\db1.vbs'
W/Z|(S,m.t({ Z^!A0$ie = Watir::IE.new
Lm:Iwt0$ie.goto $ie_site
8Tb)f8|lW~Q!}S0#$ie.buttons.each {|f| puts f.to_s}51Testing软件测试网 PT.n_ N_Ps

D+j W9`G tCbXJ7]0$ie.button(:value,"Alert").click_no_wait
x9V%EoEjy0sleep(7)
F$~h6M4x@ E0autoit = WIN32OLE.new("autoitx3.control")51Testing软件测试网H~vV4Y]f`
$a = autoit.WinWait("Microsoft Internet Explorer","",1)
gm*A(vg1g*HIG0puts $a51Testing软件测试网 iu#bKC@(sS t
$b = autoit.ControlGetText("Microsoft Internet Explorer","","Static2")
}+l-lwnJ#mhC0puts $b51Testing软件测试网Oa/N+Jk/u6f cm
$c = autoit.ControlClick("Microsoft Internet Explorer","确定","Button1")
(lH;|-|/\:K1{0puts $c51Testing软件测试网s/s5oTaC"Z;N,k JR
51Testing软件测试网"sx z4i"DU
$a $b ¥c 结果为1的时候 为通过~!
p-g*KZL6_xQ*@5Y0相关函数用法:
2`Q;jL}*Xiz_;g051Testing软件测试网%Ddv8vEN
ControlGetText:
q'ZdCS0ControlGetText ( "title", "text", controlID )
] jKr]"N:t u*Ek0Function ControlGetTextSuccess: Returns text from a control.
?W{8]h m-__Q/i0Failure: Sets @error to 1 and returns a blank string of "".51Testing软件测试网R `3~%Q,l_
51Testing软件测试网3r-yE"V"^H]0G a
51Testing软件测试网G,cC-hn0^I'r3|)a

TAG:

 

评分:0

我来说两句

Open Toolbar