|
QTP录制Flight4a.exe程序时,怎么取到订票起始站下拉框的值?
本人在网上找了些资料,但是调试还是不通过。
代码如下:
'激活敞口,如果对话框Login没有打开,则系统调用将其打开运行
If not Dialog("Login").Exist Then
SystemUtil.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
End If
'激活对话框Login
Dialog("Login").Activate
'在文本编辑框Edit内输入内容“Mercury”
Dialog("Login").WinEdit("Edit").Set "mercury"
'在文本编辑框Password内输入内容“Mercury”
Dialog("Login").WinEdit("Password:").Set "mercury"
'单击OK按钮
Dialog("Login").WinButton("OK").Click
'激活窗口Flight Reservation
Window("Flight Reservation").Activate
'在日期输入框Flight No:内输入时间类型的值
Window("Flight Reservation").WinObject("Flight No:").Type "071111"
'声明一个函数GetList
Function GetList(i)
Randomize
GetList=RandomNumber(0,i)
End Function
Dim Get_Count1,Ran_Number1
Get_Count1=Window("Flight Reservation").WinComboBox("Departure Time:").GetROProperty("items count")
Ran_Number1=GetList(Get_Count-1)
Window("Flight Reservation").WinComboBox("Departure Time:").Select "#"&Ran_Number1
Dim Get_Count2,Ran_Number2
Get_Count2=Window("Flight Reservation").WinComboBox("Arrival Time:").GetROProperty("items count")
Ran_Number2=GetList(Get_Count2-1)
Window("Flight Reservation").WinComboBox("Arrival Time:").Select "#"&Ran_Number2
Window("Flight Reservation").WinCheckBox("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights Table").Activate
Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click
Window("Flight Reservation").WinEdit("Edit").Set "1qazse4"
Window("Flight Reservation").WinEdit("Tickets:").SetSelection 0, 1
Window("Flight Reservation").WinEdit("Tickets:").Set "2"
Window("Flight Reservation").WinButton("Insert Order").Click
Window("Flight Reservation").Close
运行到这里时,就通不过了:Window("Flight Reservation").WinComboBox("Departure Time:").Select "#"&Ran_Number1
请大家帮忙下,谢谢 |
|