|
QTP11自带flight4a随机变量无法参数化
本人脚本“Window("Flight Reservation").WinButton("Button").Click
Window("Flight Reservation").ActiveX("MaskEdBox").Type "091112"
Window("Flight Reservation").WinComboBox("Fly From:").Select DataTable("fly_from", dtGlobalSheet)
Window("Flight Reservation").WinComboBox("Fly To:").Select DataTable("fly_to", dtGlobalSheet)
Window("Flight Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights Table").WinList("From").Select "19074 LON 08:00 AM LAX 08:45 AM AA $105.40"
Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click
Window("Flight Reservation").WinEdit("Name:").Set "staline"
Window("Flight Reservation").WinButton("Insert Order").Click
Window("Flight Reservation").WinButton("Button_2").Click
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Customer Name").Set "ON"
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set "staline"
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click
Window("Flight Reservation").Dialog("Open Order").Dialog("Search Results").WinList("Flight No.").Select "staline 14 AA 11121 3 1 111.000011/11/2021 Tuesday FRA Frankfurt 03:48 PM LON London 04:31 PM"
Window("Flight Reservation").Dialog("Open Order").Dialog("Search Results").WinButton("OK").Click”
datatable的两个 fly_from和 fly_to可以正常 ,但是会导致flightNo.随机参数化失败(无法使用QTP9.2的0——100的方法随机变化了)
求新方法。
“'点击新建按钮
Window("Flight Reservation").WinButton("Button").Click
'选择日期(月/日/年)
Window("Flight Reservation").ActiveX("MaskEdBox").Type "010512"
Window("Flight Reservation").WinComboBox("Fly From:").Select DataTable("fly_from", dtGlobalSheet)'参数化,值必须是下拉列表值,否则可能出错
Window("Flight Reservation").WinComboBox("Fly To:").Select DataTable("fly_to", dtGlobalSheet)'参数化,值必须是下拉列表值,否则可能出错
Window("Flight Reservation").WinButton("FLIGHT").Click
'获取数据列表个数,为参数化用,QTP11,不能用原来9.2的那种方法,郁闷
get_cont=Window("Flight Reservation").Dialog("Flights Table").WinList("From").GetROProperty ("items count")
Window("Flight Reservation").Dialog("Flights Table").WinList("From").Select RandomNumber(0, get_cont-1)'参数化
'MsgBox get_cont
Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click
Window("Flight Reservation").WinEdit("Name:").Set "lins"
Window("Flight Reservation").WinButton("Insert Order").Click
Window("Flight Reservation").WinButton("Button_2").Click
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Customer Name").Set "ON"
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set "lins"
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click
get_cont2=Window("Flight Reservation").Dialog("Open Order").Dialog("Search Results").WinList("Flight No.").GetROProperty ("items count")
Window("Flight Reservation").Dialog("Open Order").Dialog("Search Results").WinList("Flight No.").Select RandomNumber(0, get_cont2-1)'参数化
'MsgBox get_cont2
Window("Flight Reservation").Dialog("Open Order").Dialog("Search Results").WinButton("OK").Click”
这是网上找到的方法 还是无法运行,跪求QTP11 新的随机变量赋值方法。 |
|