使用QTP中的例子运行为什么也会报错啊
查询HELP中的CreateUserDefinedObject函数,会给一个例子,直接拷贝到QTP中运行,也会报错,请问各位大侠是什么原因。 可能是对象库中不存在这个对象吧,因为你是复制的脚本! QTP的例子也有bug的...这是帮助中的一个方法..就不能执行,方法返回时写错了方法名Function ItemByKeyColumn(Obj, KeyColumnIndex, KeyColumnValue, KeyItemIndex, TargetColumnIndex, micClass, TargetItemIndex)
Set Table = Obj
rowCount = Table.RowCount
' If TargetItemIndex was not specified, use 1 as default
If TargetItemIndex < 1 Then
TargetItemIndex = 1
End If
' If KeyColumnIndex was not specified, use 1 as default
If KeyItemIndex < 1 Then
KeyItemIndex = 1
End If
' Look for KeyColumnValue in the key column to determine from which
' row to retrieve the target item
Row = 0
foundIndex = 0
While Row <= RowCount And foundIndex < KeyItemIndex
Row = Row + 1
CellData = Table.GetCellData(Row, KeyColumnIndex)
If CellData = KeyColumnValue Then
foundIndex = foundIndex + 1
End If
Wend
If foundIndex < KeyItemIndex Then
Exit Function
End If
' Now that we know the row, retrieve the item (according to its micClass)
' from the target column.
ChildItemsCount = Table.ChildItemCount(Row, TargetColumnIndex, micClass)
If ChildItemsCount >=1 And ChildItemsCount >= TargetItemIndex Then
Set GetItemByKeyColumn = Table.ChildItem(Row, TargetColumnIndex, micClass, TargetItemIndex-1)
End If
End Function
页:
[1]