QTP descriptive programming issue

最后都变了- 提交于 2019-12-11 13:52:22

问题


Browser("MWAY").Page("MWAY_2").Frame("Frame").WebTable("programleveltable").highlight

n1=Browser("MWAY").Page("MWAY_2").Frame("Frame").WebTable("programleveltable").GetROProperty("name")
n2=Browser("MWAY").Page("MWAY_2").Frame("Frame").WebTable("programleveltable").GetROProperty("html id")
n3=Browser("MWAY").Page("MWAY_2").Frame("Frame").WebTable("programleveltable").GetROProperty("html tag")

msgbox "value"& vbCrLf & n1 & vbCrLf & n2 & vbCrLf & n3

Browser("MWAY").Page("MWAY_2").Frame("Frame").WebTable("name:=$PpyWorkPage$pProgramList$l1$pDocumentChecklist$l1$pSelectedDoc","html tag:=TABLE","html id:=bodyTbl_right").highlight

The above is my code

I wanted to identify one WebTable object by descriptive programming.Using the webtable object I am able to highlight.But whenever I am using name,html tag, html id tag to identify the object,it is failing.I have taken the values of the properties from object reprository.And I also verified the property values by getroproperty.I have used the same property name and property value.But still it is failing.

Please let me know what I am missing?

Thanks in advance


回答1:


I can think of two reasons that this may happen.

Most likely (if the error you get is Object not found) the cause is that by default descriptive programming uses regular expressions. The name you listed has characters which have special meaning as regular expressions ($) and should be escaped. The string you want is probably:

\$PpyWorkPage\$pProgramList\$l1\$pDocumentChecklist\$l1\$pSelectedDoc

See this answer for more details.

If the error you're getting is that the object is not unique the problem can be that there are multiple objects that match this description, in which case you should add an ordinal identifier.



来源:https://stackoverflow.com/questions/23589270/qtp-descriptive-programming-issue

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!