Micro Focus QTP (UFT) Forums

Full Version: Vierd problem with static descriptive programming
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

The below piece of code works fine with any other website(change in title values) and am not able to get the result for my AUT. Below is the Code & Err msg. Please let me know ur inputs @ the earliest.

Code:
Set alllink=Description.Create
alllink("micclass").value="Link"

Set objlink=Browser("title:=CCAMS | Home.*","micclass:=Browser").Page("title:=CCAMS | Home | 1.1.34").ChildObjects(alllink)
msgbox objlink.count

Err-Msg:Cannot find the [Page] objects Parent [Browser] class (Browser).Verify that parent properties match an object currently dispalyed in your application.
Code:
Set objlink=Browser("title:=CCAMS | Home.*","micclass:=Browser").Page("title:=CCAMS | Home | 1.1.34").ChildObjects(alllink)


Are you sure about the string that you are using?
Can you chk if the below works? If yes then then there is something wrong with the text u r passing for browser and page.

Code:
Set objlink=Browser("title:=.*").Page("title:=.*").ChildObjects(alllink)

Regards,
Ankesh
Hi Ankesh,
Above code is working but giving a different result when i add objects to object repository and run the script.
Also 1 more question -When i spy for browser object below are the object properties listed, please let me know how exactly to pass
the values in the code. Browser-
title:CCAMS | Home | 1.1.34 - Windows Internet Explorer
name:CCAMS | Home | 1.1.34
hwd:67194

Thanks a ton
Praveena
Try this out:

Code:
Set alllink=Description.Create
alllink("micclass").value="Link"

Set objlink=Browser("title:=CCAMS.*").Page("title:=CCAMS.*").ChildObjects(alllink)
msgbox objlink.count
This might do...... the error might be because of '|' symbol... u might need to suppress the special characters so that qtp recognize them...

Thanks ,
Harish Shenoy
Hi Harish,
Had tried this, but this isnt workingSad

Thanks
Praveena
One query here, if you are adding the object to OR, why u need to go with DP. you can directly use the Object as in OR. Just regularize the text/title property.

anyways, you try the below code.

| is a special character in regular expression which indicates OR. I have used escape character \.

Code:
Set objlink=Browser("title:=CCAMS \| Home\|.*").Page("title:=CCAMS \| Home \|.*").ChildObjects(alllink)
Regards,
Ankesh
Hi Ankesh,
The reason am not using OR is, have 67 webpages in the AUT for which i got to get the links. To parameterize the test am going for DP.

With the below code am gettng error number - (-2147467259)
Any more info plz..
Code:
et alllink=description.Create
alllink("micclass").value="Link"

Set objlink=Browser("name:=CCAMS \| Home \| 1.1.35","micclass:=Browser").Page("name:=CCAMS \| Home \| 1.1.35.*").ChildObjects(alllink)
msgbox Err.Number

Thanks
Praveena