|
本帖最后由 wz403692767 于 2010-12-21 12:32 编辑
- '================================
- ' 函数:LoginFlight
- ' 功能:登录订票系统
- ' 参数:FightPath,订票系统目录
- '================================
- Public Function LoginFlight(FlightPath)
- Do
- If Dialog("Login").Exist(2) = False Then
- SystemUtil.Run FlightPath
- Else
- Dialog("Login").WinEdit("Agent Name:").Set "admin"
- Dialog("Login").WinEdit("Password:").Set "mercury"
- Dialog("Login").WinButton("OK").Click
- Exit do
- End If
- Loop While True
- End Function
- '===============================
- ' 函数:OrderFlight
- ' 功能:订票
- ' 参数:无
- '===============================
- Public Function OrderFlight
- Do
- If Window("Flight Reservation").Exist(2) = False Then
- Wait 2
- Else
- Exit do
- End If
- Loop While True
- If Window("Flight Reservation").Exist(5) Then
- Window("Flight Reservation").ActiveX("MaskEdBox").Type DataTable("Date",dtGlobalSheet)
- Window("Flight Reservation").WinComboBox("Fly From:").Select DataTable("From",dtGlobalSheet)
- Window("Flight Reservation").WinComboBox("Fly To:").Select DataTable("To",dtGlobalSheet)
- Window("Flight Reservation").WinButton("FLIGHT").Click
- Wait 2
- Window("Flight Reservation").Dialog("Flights Table").WinList("From").Select 0
- Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click
- Wait 1
- Window("Flight Reservation").WinEdit("Name:").Set DataTable("Name",dtGlobalSheet)
- Window("Flight Reservation").WinEdit("Tickets:").Set "1"
- Window("Flight Reservation").WinButton("Insert Order").Click
- End If
- End Function
- '====================================
- ' 函数:ExitFlight
- ' 功能:退出订票系统
- ' 参数:无
- '====================================
- Public Function ExitFlight
- Window("Flight Reservation").WinButton("Insert Order").WaitProperty "enabled",false,100000
- Window("Flight Reservation").Close
- End Function
- '====================================
- ' Main 函数
- '====================================
- FlightPath = "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe"
- LoginFlight(FlightPath)
- OrderFlight
- ExitFlight
复制代码
我临时写了一个完整的,自己参考下,写的不好请见谅,有些没有参数化
DataTable
|
|