|
MyLabel1:
Window SetContext, "Caption=连接服务器", ""
ComboEditBox DblClick, "ObjectIndex=1", "Coords=79,6"
InputKeys "172.16.11.73"
PushButton Click, "Text=登陆"
'点击登陆后检测是否出现标题为“用户登陆”的窗口,每秒检测一次,2秒后超时
'如果没有出现则说明出现错误,提取错误信息记录到日志
'点确定关闭错误窗口后再次点击登陆
Nextwindow_result = WindowVP (Exists, "Caption=用户登录", "VP=Window Existence;Wait=1,2;ExpectedResult=Pass")
if Nextwindow_result = 1 then
SQALogMessage sqaPass, "检测到用户登陆窗口", ""
end if
if Nextwindow_result = 0 then
Window SetContext, "Caption=错误窗口", ""
Errorlabel_Result = SQAGetProperty ("Type=Label;ObjectIndex=1", "Text", Errorinfo)
SQALogMessage sqaWarning, "检测到出错窗口,出错信息为"+Errorinfo, ""
PushButton Click, "Text=确定"
goto MyLabel1
end if
以上的脚本是反复重试,你也可以做个限制,错误多少次以后就中止。
i=1 i++
i为3的时候就中止 |
|