Micro Focus QTP (UFT) Forums
Exist and ChildObjects - 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: Exist and ChildObjects (/Thread-Exist-and-ChildObjects)



Exist and ChildObjects - SAKDOSS - 09-02-2009

Hello,

I've got a problem when I try to use the "Exist" method on an object that I get thanks to ChildObjects.

For example :

Code:
Set odesc = Description.Create
odesc("Class Name").Value = "JavaTable"

Set a = JavaWindow("Index:=2").ChildObjects(odesc)

msgbox a.count          'Display "3"

a(0).highlight          'Works fine
msgbox a(0).Exist       'Display "False"
a(0).highlight          'Throw a general run error


I don't understand why the Exist method doesn't work.
Question 1 : How can I use the Exist method in this case ?


I tried to use "micClass" instead of "Class Name" but the JavaTables are not detected.

Code:
Set odesc = Description.Create
odesc("micClass").Value = "JavaTable"

Set a = JavaWindow("Index:=2").ChildObjects(odesc)

msgbox a.count          'Display "0"

Question 2 : Do you know why the "micClass" property doesn't match any of the 3 JavaTables in my window ?



Thanks in advance !


RE: Exist and ChildObjects - sreekanth chilam - 09-03-2009

HI SAKDOSS,

Please find the below example for an "WebTable" & its working fine for me.

Example:
Code:
Set obj=Description.Create
obj("micclass").Value="WebTable"
Set x=browser("Gmail...").Page("Gmail..").Frame("cu4idgi98gudv").ChildObjects(obj)

       msgbox x.count      ' displayed 1
       x(0).highlight         ' this worked fine

       msgbox x(0).Exist    ' displayed True
       msgbox x(0).GetROProperty("Visible")  'displayed True

       x(0).highlight         ' again worked fine

So explore from ur side for ur Java Appl & i hope you can solve it.


RE: Exist and ChildObjects - SAKDOSS - 09-03-2009

Ok.

I still don't understand why the micclass doesn't match any JavaTable but instead of "Exist(0)" I will use "GetROProperty("displayed")".

Thank you for the example !