QTP 无法解析 描述性编程描述的desktop下的Dialog

2012-06-29  刘欢 

       问题简述如题,还望哪位大虾指点,不胜感激
 
  以 QTP 自带的Windows Application (飞机定票程序)为例,登陆场景的描述性编程脚本如下:
Dialog("text:=Login", "nativeclass:=#32770").WinEdit("attached text:=Agent Name","nativeclass:=Edit").Set "1234"
Dialog("text:=Login", "nativeclass:=#32770").WinButton("text:=Help","nativeclass:=Button").Click
Dialog("text:=Login", "nativeclass:=#32770").Dialog("text:=Flight Reservations","nativeclass:=#32770").WinButton("text:=OK","nativeclass:=Button").Click
Dialog("text:=Login", "nativeclass:=#32770").WinEdit("attached text:=Password","nativeclass:=Edit").SetSecure"4fed77fe165419c198d7beee3c1f1d2fa0424f8e"
Dialog("text:=Login", "nativeclass:=#32770").WinButton("text:=OK","nativeclass:=Button").Click
 
  尝试Run这段脚本的时候,QTP提示错误如下:
 
(为了避免图片无法正常现实,copy error message如下:
Cannot identify the object "[ WinEdit ]" (of class WinEdit). Verify that this object's properties match an object currently displayed in your application.
Line (12): "Dialog("text:=Login", "nativeclass:=#32770").WinEdit("attached text:=Agent Name","nativeclass:=Edit").Set "1234"".
Tip: If the objects in your application have changed, the Maintenance Run Mode can
help you identify and update your steps and/or the objects in your repository.)
 
  奇怪的是如果将用对象库和对象识别的话就能正常运行:
Dialog("Login").WinEdit("Agent Name:").Set "1234"
Dialog("Login").WinButton("Help").Click
Dialog("Login").Dialog("Flight Reservations").WinButton("OK").Click
Dialog("Login").WinEdit("Password:").SetSecure "4fed77fe165419c198d7beee3c1f1d2fa0424f8e"
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").WinMenu("Menu").Select "File;Exit"
 
  纠结了好几天了,网上也查不出有效的解决方法,哪位大虾知道要怎么处理这种异常吗?

Run Error Message

 

》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》

解决方案(2012/08/27):

原代码:

Dialog ("text:=Login","nativeclass:=#32770").Dialog("text:=Flight Reservations", "nativeclass:=#32770")...

1. 修改如下:

Dialog ("text:=Login").Dialog("text:=Flight Reservations")...

2. 修改如下:

Dialog ("text:=Login","nativeclass:=#32770","index:=0").Dialog("text:=Flight Reservations", "nativeclass:=#32770","index:=1")...

383°/3834 人阅读/0 条评论 发表评论

登录 后发表评论