|
我用QTP自带的例子录制登录脚本,参数化用户名和密码,对每个提示信息设置集合点。脚本回放时在第三次迭代就报错,为什么啊!!急!盼高手解决!
Window("app").WinListView("SysListView32").Activate "flight4b.exe"
Dialog("Login").WinEdit("Agent Name:").Set DataTable("username", dtGlobalSheet)
Dialog("Login").WinEdit("Agent Name:").Type micTab
Dialog("Login").WinEdit("Password:").SetSecure DataTable("password", dtGlobalSheet)
Dialog("Login").WinButton("OK").Click
If Window("Flight Reservation").Exist Then
Window("Flight Reservation").Check CheckPoint("Flight Reservation_2")
Window("Flight Reservation").Close
else If Dialog("Login").Dialog("Flight Reservations").Static("Incorrect password. Please try again").Exist Then
Dialog("Login").Dialog("Flight Reservations").Static("Incorrect password. Please try again").Check CheckPoint("Incorrect password.Please try again_7")
Dialog("Login").Dialog("Flight Reservations").WinButton("确定").Click
Dialog("Login").WinButton("Cancel").Click
else If Dialog("Login").Dialog("Flight Reservations").Static("Agent name must be at least 4 characters long").Exist Then
Dialog("Login").Dialog("Flight Reservations").Static("Agent name must be at least 4 characters long").Check CheckPoint("Please enter password_2")
Dialog("Login").Dialog("Flight Reservations").WinButton("确定").Click
Dialog("Login").WinButton("Cancel").Click
else if Dialog("Login").Dialog("Flight Reservations").Static("Password must be at least 4 characters long").Exist Then
Dialog("Login").Dialog("Flight Reservations").Static("Password must be at least 4 characters long").Check CheckPoint("Please enter password_3")
Dialog("Login").Dialog("Flight Reservations").WinButton("确定").Click
Dialog("Login").WinButton("Cancel").Click
else If Dialog("Login").Dialog("Flight Reservations").Static("Please enter agent name").Exist Then
Dialog("Login").Dialog("Flight Reservations").Static("Please enter agent name").Check CheckPoint("Please enter password_4")
Dialog("Login").Dialog("Flight Reservations").WinButton("确定").Click
Dialog("Login").WinButton("Cancel").Click
else If Dialog("Login").Dialog("Flight Reservations").Static("Please enter password").Exist Then
Dialog("Login").Dialog("Flight Reservations").Static("Please enter password").Check CheckPoint("Please enter password_5")
Dialog("Login").Dialog("Flight Reservations").WinButton("确定").Click
Dialog("Login").WinButton("Cancel").Click
end if
end if
end if
end if
end if
end if
参数化
zhang MERCURY
zhang 1111
z MERCURY
zh MERCURY
zha MERCURY
zhang M
zhang ME
zhang MER
zhang
MERCURY
附件是对象截图! |
|