QTP识别对象

上一篇 / 下一篇  2009-09-05 16:24:07

 前几天,在测公司外包的时候需要批量验证数据,500条数据需要一条一条验证,如果眼睛跟着检查的话...... 会死人的。

[信息来自"岁月联盟"]

        用QTP来检查吧,想到就做。录脚本,设参数,运行... 报错!而且还是Cannot identify object。立马查看对象库,奇怪啊,对象库中有不能识别的对象,但就是无法运行通过。上网查了好多资料,基本都无效。郁闷啊...[内容来自"岁月联盟"]

        第二天,和同事商讨,原来她和我遇到了同样的问题,也试了好多方法,无效。资源来自"岁月联盟"

        第三天,怀疑自己QTP问题,之前装Build 8.2,现在卸载改装9。接着又是一阵忙活,问题依旧。哎,都是撞墙的准备了 555。然后同事建议采用编辑的方式录制看看是否能通过。这点提醒了我,我怎么没想到呢,好歹我也算是写过代码的。出于习惯,在录制过后,稍微留意了下原始脚本,果然被我看出问题来,如下:

Syue.com

        插入的检查点的脚本:

内容来自"岁月联盟"

        Browser("MS/B Express_2").Page("MS/B Express_2").WebEdit("EMail").Check CheckPoint("CompareEmail")

(Syue.com)

        插入的编辑时的脚本:[信息来源"岁月联盟"]

        Browser("MS/B Express_2").Window("MS/B Express -- Web Page").Page("MS/B Express").WebEdit("EMail").Set ”

[本文来自"岁月联盟"]

        问题就出在这里,确实是由于对象找不到,但是QTP在设检查点(手动添加的对象)的时候没有自动和其依赖的父对象进行关联,才导致这一问题。

[资源来自"岁月联盟"]

        修改后的脚本:[本文来自"岁月联盟"]

        Browser("MS/B Express_2").Window("MS/B Express -- Web Page").Page("MS/B Express").WebEdit("EMail").Check CheckPoint("CompareEmail")

信息来自"岁月联盟"

        另外,检查点的Name应该和源对象名不同,便于后期手工检查出错数据。

来源"岁月联盟"

        QTP Help对于此问题的解决方案如下:[来源"岁月联盟"]

        Run Error: Cannot identify object

www.Syue.com

        This error indicates that there is no object in the current view of the application that matches the descrīption saved in the object repository for the object.

"岁月联盟"提供

        This error occurs in one of two basic situations:

["岁月联盟"提供]

        The object is not (or not yet) displayed in the application at the time of the error."岁月联盟"

        The object is present, but the descrīption in your application has changed so that it no longer matches the test object descrīption that QuickTest is using to identify the objec


TAG:

 

评分:0

我来说两句

Open Toolbar