问题
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