poorcolor 发表于 2009-6-19 14:18:34

QTP问题,高手帮忙下

脚本:


SystemUtil.Run "D:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe","","D:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\","open"
Dialog("Login").WinEdit("Agent Name:").Set DataTable("username", dtGlobalSheet)
Dialog("Login").WinEdit("Password:").SetSecure "4a3ae16ff4c8d82b1b253b1d0ef54d1019048781"
Dialog("Login").Activate
Dim x
x=Dialog("Login").WinEdit("Agent Name:").GetROProperty("text")
If x="wish01" Then
Window("Flight Reservation").Close
else
Dialog("Login").WinButton("OK").Check CheckPoint("aser")
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").ActiveX("MaskEdBox").Type "121212"
Window("Flight Reservation").WinComboBox("Fly From:").Select DataTable("start", dtGlobalSheet)
Window("Flight Reservation").WinComboBox("Fly To:").Select DataTable("end", dtGlobalSheet)
Window("Flight Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights Table").WinList("From").Activate RandomNumber(0, 2)
Window("Flight Reservation").WinEdit("Name:").Type "T"
Window("Flight Reservation").WinEdit("Name:").Set "Tim"
Window("Flight Reservation").WinButton("Insert Order").Click
Window("Flight Reservation").Close
End If



运行到If x="wish01" Then
Window("Flight Reservation").Close出错,怎么让她运行到这里的时候点cancel那个按钮呢?

poorcolor 发表于 2009-6-19 14:20:39

11

username   start         end
wish03          Portland        Zurich
wish01          Frankfurt        London
wish02          London        Portland

poorcolor 发表于 2009-6-19 14:23:23

11

好像是这句:Dialog("Login").WinButton("regexpwndtitle:=Cancel").Click
页: [1]
查看完整版本: QTP问题,高手帮忙下