标题: qtp的简单问题! [打印本页] 作者: lhjtc8257 时间: 2007-10-16 22:42 标题: qtp的简单问题! 1)此段是QTP自带的实例,录制的,一个验证登陆的脚本(为什么总是失败???想不通)
Dialog("Login").WinEdit("Agent Name:").Set "admin"
Dialog("Login").WinEdit("Password:").Set "mercury"
Dialog("Login").WinButton("OK").Click
wait 10
Window("Flight Reservation").Activate
if window("Flight Reservation").Exist = true then
reporter.ReportEvent micPass,"LOGIN","PASS"
else
reporter.ReportEvent micFail,"LOGIN","FAIL"
end if
2)if dialog("Login").Exist<>true and window("Flight Reservation").Exist = true then -------成功
if window("Flight Reservation").Exist= true and dialog("Login").Exist<>true then -------失败,为什么???作者: lhjtc8257 时间: 2007-10-16 22:56
Dialog("Login").WinEdit("Agent Name:").Set "admin"
Dialog("Login").WinEdit("Password:").SetSecure "4714cac219e9df77d79af15a3355d9b0c20fc92d"
Dialog("Login").WinButton("OK").Click
wait 10
If window("Flight Reservation").Exist =true and dialog("Login").Exist<>true then
reporter.ReportEvent micPass,"登陆","PASS"
else
reporter.ReportEvent micPass,"登陆","FAIL"
end if