131425god 发表于 2010-9-26 09:44:25

描述性编程回放对象不一致,用其他属性标示无用

以下是我QTP里运行的一段语句:
Call newbuttontonewspecitem()
Function newbuttontonewspecitem()
        Browser("TechExcel DevSpec WebSite").Page("TechExcel DevSpec WebSite").Sync

        Browser("title:=TechExcel DevSpec WebSite").Page("title:=TechExcel DevSpec WebSite").Frame("name:=topframe","title:=TechExcel DevSpec WebSite").WebButton("type:=button","class:=btn_new","html id:=btn_link").Click

        'Browser("TechExcel DevSpec WebSite").Page("TechExcel DevSpec WebSite").Frame("extcomp1002iframe").WebEdit("ctl04$ctl00$txtLongtext").Set "newbuttontonewspecitem"
        Browser("title:=TechExcel DevSpec WebSite").Page("title:=TechExcel DevSpec WebSite").WebEdit("Type:=text","html id:=ctl04_ctl00_txtLongtext","width:=637","height:=23").Set "newbuttontonewspecitem"
        Browser("title:=TechExcel DevSpec WebSite").Page("title:=TechExcel DevSpec WebSite").WebList("select type:=ComboBox Select","html id:=ctl04_ctl02_listDropDown").Select "Terry Johnson"
        Browser("title:=TechExcel DevSpec WebSite").Page("title:=TechExcel DevSpec WebSite").WebButton("type:=button","name:=Save","html id:=btnSave","width:=40","heght:=19","html tag:=BUTTON").Click

End Function

运行到最后一句报错:
The "[ WebButton ]" object's description matches more than one of the objects currently displayed in your application. Add additional properties to the object description in order to uniquely identify the object.

Line (14): "Browser("title:=TechExcel DevSpec WebSite").Page("title:=TechExcel DevSpec WebSite").WebButton("type:=button","name:=Save","html id:=btnSave","width:=40","heght:=19","html tag:=BUTTON").Click".

对于上面标注红色和绿色的地方,我对第二个对象webbutton 已经添加了很多不一样的属性来区分了,为什么还是报错。(备注:如果不用描述性编程,是可以区分开来的,不过那不是我想要的。)

131425god 发表于 2010-9-26 09:52:26

:sleepy:自己先顶一下

lyscser 发表于 2010-9-26 19:46:25

驱动对象找些有意义的属性,比如name、text、index之类的,你这样写能匹配很多个对象
页: [1]
查看完整版本: 描述性编程回放对象不一致,用其他属性标示无用