51Testing软件测试论坛
标题:
针对popups类对话框的watir处理方法之一
[打印本页]
作者:
Spark.lee
时间:
2009-9-16 11:18
标题:
针对popups类对话框的watir处理方法之一
针对该类对话框的watir处理方法:
require 'watir'
require 'win32ole'
require 'watir/WindowHelper'
# 登陆
$ie_site ='http://members.shaw.ca/paul_rogers/watir_tests/popups1.html'
$ie = Watir::IE.new
$ie.goto $ie_site
$ie.buttons.each {|b| puts b.to_s}
$ie.button(:value,"Prompt").click_no_wait
sleep(5)
autoit = WIN32OLE.new("autoitx3.control")
ret = autoit.WinWait("Explorer 用户提示","",1)
ress =autoit.ControlFocus("Explorer 用户提示","","Edit1")
resss =autoit.ControlSetText("Explorer 用户提示", "","Edit1","New Text Here")
ss =autoit.ControlClick("Explorer 用户提示", "确定","Button1")
涉及到的函数用法格式和返回值:
WinWait
:
WinWait ( "title" [, "text" [, timeout]] )
Success: Returns 1.
Failure: Returns 0 if timeout occurred.
ControlFocus:
ControlFocus ( "title", "text", controlID )
Success: Returns 1.
Failure: Returns 0.
ControlSetText:
ControlSetText ( "title", "text", controlID, "new text" [, flag] )
Success: Returns 1.
Failure: Returns 0 if window/control is not found.
ControlClick:
ControlClick ( "title", "text", controlID [, button [, clicks [, x [, y ]]]] )
Success: Returns 1.
Failure: Returns 0.
[
本帖最后由 Spark.lee 于 2009-9-16 11:23 编辑
]
作者:
shanxi
时间:
2009-12-2 13:11
vbs也行
放到excel里面 可以自动处理对话框
对web程序来说 弹出这样框的情况很少 也不需要封装成很大的一个类。
作者:
ahtest
时间:
2010-5-20 14:17
版主的,一定要顶...
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2