|
打开rational robot GUI录制程序后,对桌面上的时钟进行设置,将时间改变(提前一天:7号改为8号)。然后回放时出错,对时钟的操作没反应!
相关代码如下:
Window SetContext, "Class=Shell_TrayWnd", ""
GenericObject DblClick, "Text=11:04 AM", "Coords=23,10"
Window SetContext, "Caption=Date and Time Properties", ""
Calendar Click, "Text=Friday, August 08, 2003", "Coords=98,46"
PushButton Click, "Text=OK"
原因是识别方法有问题:
GenericObject DblClick, "Text=11:04 AM", "Coords=23,10"
Calendar Click, "Text=Friday, August 08, 2003", "Coords=98,46"
对象都是根据Text属性识别的,Text是变化的所以导致回放失败。
解决方法:改变识别方法。Robot--Tools--GUI Record Options---Object Recognition Order将Object Type中的Generic和Calendar的 Recognition methed order中的Index分别移动到Text前面。这样录制的脚本为:
Window SetContext, "Class=Shell_TrayWnd", ""
GenericObject DblClick, "ObjectIndex=2", "Coords=15,8"
Window SetContext, "Caption=日期/时间 属性", ""
Calendar Click, "ObjectIndex=1", "Coords=124,41"
PushButton Click, "Text=确定" |
|