51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 1597|回复: 2
打印 上一主题 下一主题

[求助] 使用QTP中的例子运行为什么也会报错啊

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2009-6-22 18:51:56 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
查询HELP中的CreateUserDefinedObject函数,会给一个例子,直接拷贝到QTP中运行,也会报错,请问各位大侠是什么原因。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?(注-册)加入51Testing

x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
发表于 2009-6-23 10:37:30 | 只看该作者
可能是对象库中不存在这个对象吧,因为你是复制的脚本!
回复 支持 反对

使用道具 举报

该用户从未签到

3#
发表于 2009-6-23 15:52:59 | 只看该作者
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
回复 支持 反对

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /2 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-6-24 23:38 , Processed in 0.076547 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表