|
写了这么一段小脚本,想检查下航班信息中的price是否正确回显到相应栏位中,可是执行到红色部分就报错:general run error,为啥呢?然后我把Price这个winedit加入到对象库中,就可以了,为啥呢?难道是因为price当时状态是readonly的吗?
Function GetList(i)
Randomize
GetList=RandomNumber(0,i) '随机取0到i之间的数
End Function
Dialog("Login").WinEdit("Agent Name:").Set "shine"
Dialog("Login").WinEdit("Agent Name:").Type micTab
Dialog("Login").WinEdit("Password:").SetSecure "47cfb3b3fecfd7df981804d774c7bf04178838b2"
Dialog("Login").WinEdit("Password:").Type micReturn
Window("Flight Reservation").WinObject("Date of Flight:").Type "030609"
Window("Flight Reservation").WinComboBox("Fly From:").Select "Denver"
Window("Flight Reservation").WinComboBox("Fly To:").Select "Sydney"
Window("Flight Reservation").WinButton("FLIGHT").Click
Dim get_count,ram,result
get_count = window("Flight Reservation").Dialog("Flights Table").WinList("From").GetItemsCount
ram = GetList(get_count-1)
result = window("Flight Reservation").Dialog("Flights Table").WinList("From").GetItem(ram)
Window("Flight Reservation").Dialog("Flights Table").WinList("From").Select result
'msgbox(myprice)
Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click
Window("Flight Reservation").WinEdit("Name:").Set "linshine"
Window("Flight Reservation").WinEdit("Tickets:").Set "2"
Dim myprice,myinfo
myinfo = split (result," ")
myprice = myinfo(22)
If myprice = Window("Flight Reservation").WinEdit("attached text:=Price:").GetROProperty("text") then
msgbox(myprice)
else msgbox("bug")
End If |
|