不要追求绝对的公平,红尘之中没有公平而言,人活一世,难得糊涂。                                           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软件测试网0~/G8K%wnz!n8C#_+~Q
针对该警示框的识别问题:
:Be}0ey051Testing软件测试网Y3U$B?9N/Krun!~gm
这个比较简单点。。。51Testing软件测试网 a`Ar C-s"jom.u

yax:a5[6IbI2k&q[0require 'watir'51Testing软件测试网 ^cA#N#B9L
require 'win32ole'51Testing软件测试网^J@2C/E
require 'watir/WindowHelper'
U3z!jx~%\)F0# 登陆51Testing软件测试网(t6hE\ k
$ie_site ='http://members.shaw.ca/paul_rogers/watir_tests/popups1.html'51Testing软件测试网.d!O+E,}O#Jl(mR
#$f = 'E:\WorkSpace\00-Automation\03_MOA\02_Branches\JiangXi\V2.9.1\Lib\db1.vbs'
?f5o^v:a1O~0$ie = Watir::IE.new51Testing软件测试网8F`^9C A0Vv R N
$ie.goto $ie_site
NE!|0]S"Do0#$ie.buttons.each {|f| puts f.to_s}
&o g%g vX:Lt$r0
wB(J `h)Db0$ie.button(:value,"Alert").click_no_wait
M+v$N8q$u#G6@(Ml0sleep(7)51Testing软件测试网*efVpj g
autoit = WIN32OLE.new("autoitx3.control")51Testing软件测试网qHby M
$a = autoit.WinWait("Microsoft Internet Explorer","",1)
I1pU T9cE4G,r@%_E0puts $a
td"R2F.xAL0$b = autoit.ControlGetText("Microsoft Internet Explorer","","Static2")51Testing软件测试网7A,W ZdkAJ
puts $b
;u7rEic#s U m0$c = autoit.ControlClick("Microsoft Internet Explorer","确定","Button1")
T*|%Yp8t0puts $c51Testing软件测试网;lsX m.~{v$j

}_kXu0$a $b ¥c 结果为1的时候 为通过~!
b8nRv5[o4|1g N0相关函数用法:51Testing软件测试网&_'cNL[#I(m
51Testing软件测试网~\:m V0[v-r1C/}eY
ControlGetText:
t9z7K`JG)ZDH;ax(x0ControlGetText ( "title", "text", controlID )
:D'F0^.L J*@0Function ControlGetTextSuccess: Returns text from a control.51Testing软件测试网 gVban3Z
Failure: Sets @error to 1 and returns a blank string of "".51Testing软件测试网x Q2C2q[&[ l#y,^

QU Ku$Xd0
^Wxo4Ubc!_e'A0

TAG:

 

评分:0

我来说两句

Open Toolbar