获取对象数量时用GetItemsCount报错
在用flight4a做一个订票删除时,需要统计订票数量,然后用力GetItemsCount函数,但是运行时出现报错,报错信息如下:对象不支持此属性或方法: 'GetItemsCount'Line (11): "IntNumber_SearchResult=Window("Flight Reservation").Dialog("Open Order").Dialog("Search Results").Static("Flight No.").GetItemsCount".
请教下各位大神,应该如何修改?
全部程序如下:
Dialog("Login").WinEdit("Agent Name:").Set "mercury"
Dialog("Login").WinEdit("Password:").SetSecure "547591efd519f38b5db54b7d61c46fa8984c4c9e"
Dialog("Login").WinButton("OK").Click
Dim IntNumber_SearchResult,Str_SearchResult
Dim Delete_OrderNO
Window("Flight Reservation").WinMenu("Menu").Select "File;Open Order..."
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Customer Name").Set "ON"
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set "fengjh"
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click
While Window("Flight Reservation").Dialog("Open Order").Dialog("Search Results").Exist(5)
IntNumber_SearchResult=Window("Flight Reservation").Dialog("Open Order").Dialog("Search Results").Static("Flight No.").GetItemsCount
Str_SearchResult=Window("Flight Reservation").Dialog("Open Order").Dialog("Search Results").Static("Flight No.").Get(RandomNumber(0,IntNumber_SearchResult-1))
Window("Flight Reservation").Dialog("Open Order").Dialog("Search Results").Static("Flight No.").Select Str_SearchResult
Window("Flight Reservation").Dialog("Open Order").Dialog("Search Results").WinButton("OK").Click
Delete_OrderNO=Window("Flight Reservation").WinEdit("Order No:").GetROProperty("text")
Window("Flight Reservation").WinButton("Delete Order").Click
Window("Flight Reservation").Dialog("Flight Reservations").WinButton("是(Y)").Click
Reporter.ReportEvent micPass,"删除的订单号是:"&Delete_OrderNO,"删除的订单是:"&Str_SearchResult
Window("Flight Reservation").WinMenu("Menu").Select "File;Open Order..."
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Customer Name").Set "ON"
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set "fengjh"
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click
Wend
Window("Flight Reservation").Dialog("Open Order").Dialog("Flight Reservations").WinButton("确定").Click
Window("Flight Reservation").Dialog("Open Order").WinButton("Cancel").Click
Reporter.ReportEvent micPass,"删除订单成功","订单查询不到,说明删除成功或者本身没有订单"
求大神指导 Static("Flight No.")只是一个文本标签,不支持GetItemsCount
Dialog("Search Results")对象下应该有个WinList对象,试试这个 当对象是个集合类的对象时,才有GetItemsCount属 性吧,试试楼上说的方法 mvstar 发表于 2014-12-1 13:56
Static("Flight No.")只是一个文本标签,不支持GetItemsCount
Dialog("Search Results")对象下应该有个Win ...
改成Winlist对象之后可以正确调用该函数了,但是又出现了一个问题,第十二行我把Static也改成Winlist对象了,出现报错:对象不支持此属性或方法: 'Window(...).Dialog(...).Dialog(...).WinList(...).Get'
Line (12): "Str_SearchResult=Window("Flight Reservation").Dialog("Open Order").Dialog("Search Results").WinList("Flight No.").Get(RandomNumber(0,IntNumber_SearchResult-1))".
请教一下该如何解决,谢谢。 sterson 发表于 2014-12-1 14:19
当对象是个集合类的对象时,才有GetItemsCount属 性吧,试试楼上说的方法
对象修改后可以用了,但是又出现个问题,详见楼上,麻烦看看怎么处理才是 楼上各位,刚回复完就找到问题了,函数写错了,应该是GetItem(),不好意思。
页:
[1]