Micro Focus QTP (UFT) Forums
Child objects - Error while retrieving name - 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: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Child objects - Error while retrieving name (/Thread-Child-objects-Error-while-retrieving-name)



Child objects - Error while retrieving name - ksrikanth2k9 - 03-28-2011

This is my code...

Code:
Set obj=description.Create
obj("micclass").value="WebEdit"
set Objchld=Browser("OrangeHRM").Page("OrangeHRM").Frame("rightMenu").ChildObjects(obj)
msgbox Objchld.count

For each i in Objchld
i= i.name
Next


whenever i run this code it's displaying childobject count as 11
after that it is showing error as "Object doesn't support this property or method" (For for each loop).Why it's happening? Any help is appreciated.


RE: Child objects - basanth27 - 03-28-2011

Try this,

Code:
Set obj=description.Create
obj("micclass").value="WebEdit"
set Objchld=Browser("OrangeHRM").Page("OrangeHRM").Frame("rightMenu").ChildObjects(obj)
msgbox Objchld.count

For i = 0 to Objchld.Count -1
oName= Objchld(i).name
msgbox oName
Next



RE: Child objects - ksrikanth2k9 - 03-28-2011

Thanks it's working.can we use for each loop for the same