例如,
Window("test_window").WinTreeView("TTreeView").type "test1"
Window("test_window").WinTreeView("TTreeView").Click x, y, micRightBtn
这个x,y无法得到,不加坐标又不能点到正确的位置
于是我使用下面的代码:
Window("test_window").WinTreeView("TTreeView").type "test1"
Dim x,y
x=Window("test_window").WinTreeView("TTreeView").GetItemProperty("test1",abs_x)
y=Window("test_window").WinTreeView("TTreeView").GetItemProperty("test1",abs_y)
Window("test_window").WinTreeView("TTreeView").Click x, y, micRightBtn
但是运行到 dim下面一行就停止了,报告中的错误信息为:
Cannot identify the specified item of the TTreeView object. Confirm that the specified item is included in the object's item collection
QTP的帮助对GetItemProperty 的Description 是
Returns the current value of a property for a node in the tree-view.
其语法是
object.GetItemProperty (Item, Property)作者: walker1020 时间: 2007-3-1 13:13 标题: QTP 提供的GetItemProperty Method (WinTreeView)示例 Sub GetItemProperty_Example()
'The following example uses the GetItemProperty method to go to report
'each node's name to the Results as it iterates over it.
End Sub作者: walker1020 时间: 2007-3-1 13:21 标题: QTP的帮助对 GetItemProperty 的参数的说明 Item Required. A Variant value. The item name (with quotes) or numeric index (without quotes) can denote the item. The first item in a tree is numbered 0.