|
下面是我编辑的一段脚本,内容是在一个登录页面输入不正确的用户名、密码,弹出一个提示框,提示重新输入用户名、密码,点击这个提示框上的“确定”按钮,回到登录页面。我想先根据输入的用户名、密码判断输入是否正确,用sqafindobject判断提示框是否弹出,如果弹出,经确认后点击上面的“确认”按钮。现在的情况是,脚本可以执行,但是IF语句根本就没有执行,请大家帮我看一下,问题出在哪里了
Sub Main
Dim Result As Integer
startbrowser "http://www.asdf.com.cn/scweb/logon.jsp", "WindowTag=WEBBrowser"'打开浏览器
window WMaximize,"currentwindow",""'把当前窗口最大化
EditBox Click, "Name=username", "Coords=1,1"
InputKeys "asdf{TAB}"'输入用户名
InputEncKeys "CgAAABUAAAAVDaAIw/ZzQDyf"'输入密码
sqaconsolewrite"asdfasdf1"
HTMLImage Click, "Index=26", "Coords=1,1"'点击登录按钮
sqaconsolewrite "asdfasdf2"
if sqafindobject("type = window;Caption = Microsoft Internet Explorer;class=#32770") = sqasuccess then '判断是否弹出提示框
sqaconsolewrite "asdfasdf3"
window setcontext,"Caption = Microsoft Internet Explorer;class=#32770",""'设置焦点在弹出页面上
sqaconsolewrite "asdfasdf4"
if sqafindobject("type = label;text = 用户名或密码输入错误,请重新输入!") = sqasuccess and sqafindobject("type = pushbutton;text = 确定") = sqasuccess then
'result = sqapass
sqaconsolewrite "asdfasdf5"
'sqaconsolewrite str(sqasuccess )
PushButton Click, "Text=确定"
end if
end if
End Sub |
|