Micro Focus QTP (UFT) Forums
Child Objects - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Child Objects (/Thread-Child-Objects)



Child Objects - wheelercha - 10-14-2010

Hi,

I am attempting to create a collection of objects that should enable me to click an arrow image on a drop down list.

In the past I simply did this by:
Code:
Set bDesc = Description.Create()
         bDesc("micclass").Value = "Image"
         bDesc("name").Value = "Image"
Set  ImgCollect = Browser("browswer").Page("page").Webtable("webtable").ChildObjects(bDesc)

AND SO ON....

I am seeing now that the IMAGE that I clicked in the past is now actually 2 webtables deep.

Meaning if I spy on this image that I want to click, I see:
--Browser
----Page
-----Webtable
-------Webtable
-----------Image

Where before - and like in the beginning of my commment it was simply:
--Browser
----Page
-----Webtable
---------Image

I tried this:
Code:
Browser("browser").Page("page").Webtable("webtable").Webtable("webtable").childobjects(bdesc)

QTP does not like this and gives me a general runtime error. Does anyone know a way I can get around this? And click this?

Thanks,
Charles


RE: Child Objects - jsknight1969 - 10-15-2010

You could try not using Webtables and just get all the ChildObjects of the page.

Code:
rowser("browser").Page("page").ChildObjects(bdesc)

that should be able to get the image anywhere on the page regardless of surrounding tables/tags.

PS. You can't use the name description. Try html id and tag. Name only exists in the Object repository not in the page code and can not be used with DP, unless it's been specifically added by the developers which doesn't usually happen.


RE: Child Objects - KavitaPriyaCR - 10-19-2010

Yes, bDesc("name").Value = "Image" >> If this is the one developers used in their code, then we have to use the property name which has the unique value for that object, say for example html id.
Else QTP fails to identify the object as multiple objects will have the same property value.