1
votes

I am getting the URL and HTML ID of the frame using the GetRoProperty method and using the same values to identify the object via descriptive programming.

QTP is identifying the object using HTML ID, but when it uses URL for identifying its shows

Cannot identify the object "[ Frame ]" (of class Frame). Verify that this object's properties match an object currently displayed in your application.

Line (24): "print Browser("SAP - [Search: Accounts]").Window("Partner Selection Document").Page("Partner Selection Document").Frame("url:="&rourl).GetROProperty("html id")".

In OR, QTP identifies the frame using URL alone without any other properties.

Following are the lines of code involved:

rourl=Browser("SAP - [Search: Accounts]").Window("Partner Selection Document").Page("Partner Selection Document").Frame("Frame").GetROProperty("url")

print rourl
roid=Browser("SAP - [Search: Accounts]").Window("Partner Selection Document").Page("Partner Selection Document").Frame("Frame").GetROProperty("html id")
print roid

print Browser("SAP - [Search: Accounts]").Window("Partner Selection Document").Page("Partner Selection Document").Frame("html id:="&roid).GetROProperty("html id")
'prints html id
print Browser("SAP - [Search: Accounts]").Window("Partner Selection Document").Page("Partner Selection Document").Frame("url:="&rourl).GetROProperty("html id")
'shows error message

url of frame is http://part1.part2.part3.part4.com:8082/sap(bD1FTiZjPTUwMCZpPTEmZT1WRVZUVkY5Rk1rVkJWVlJQTVRJM01USmZWY3gxMlR4aUNVRGhBSUFBQ2hvd2NnJTNkJTNk)/bc/bsp/sap/crm_ui_frame/bspwdapplication.do?popup-name=_POPUP0001&wcf-request-ticket=929D13152F6D62ACF1AB51BD8BDC2819

I have modified the url as

http://part1\.part2\.part3\.part4\.com:8082/sap\(bD1FTiZjPTUwMCZpPTEmZT1WRVZUVkY5Rk1rVkJWVlJQTVRJM01USmZWY3gxMlR4aUNVRGhBSUFBQ2hvd2NnJTNkJTNk\)/bc/bsp/sap/crm_ui_frame/bspwdapplication\.do\?popup-name=_POPUP0001&wcf-request-ticket=929D13152F6D62ACF1AB51BD8BDC2819

But still is not identifying.

rourl="http://part1\.part2\.part3\.part4\.com:8082/sap\(bD1FTiZjPTUwMCZpPTEmZT1WRVZUVkY5Rk1rVkJWVlJQTVRJM01USmZWY3gxMlR4aUNVRGhBSUFBQ2hvd2NnJTNkJTNk\)/bc/bsp/sap/crm_ui_frame/bspwdapplication\.do\?popup-name=_POPUP0001&wcf-request-ticket=929D13152F6D62ACF1AB51BD8BDC2819"
Browser("SAP - [Search: Accounts]").Window("Select Transaction Type").Page("Select Transaction Type").Frame("url:="&rourl).GetROProperty("html id")
1

1 Answers

0
votes

The problem is probably due to the fact that descriptive programming uses regular expressions and the object repository by default does not use regular expressions.

Your URL may contain special characters that have a different meaning when viewed as a regular expression. The most obvious regex special characters that tend to appear in URLs are . and ?. I think that you have a problem with ? (since . matches "." but it can cause ambiguities.

Try this:

Function EscapeRegex(str)
    str = Replace(str, "?", "\?")
    str = Replace(str, ".", "\.")
    EscapeRegex = str   
End Function

print Browser("SAP - [Search: Accounts]").Window("Partner Selection Document").Page("Partner Selection Document").Frame("html id:="& EscapeRegex(roid)).GetROProperty("html id")

If this doesn't solve your problem please add special characters to the EscapeRegex function, if you still can't get it to work please post a sample URL that causes this problem.

For reference here's a (partial?) list of special regular expression characters: []*.?+^$()|{}\ (here's how it's done in javascript).