Developing The Basic UFT Testing Agent > Developing Support for the Test Object Model > Implementing GetChildren

Implementing GetChildren

UFT calls GetChildren to retrieve the object IDs of the objects directly contained by the object specified in the method call. UFT sometimes calls GetChildren recursively to get the entire tree of the objects descendents. The object passed to the method can be a member of the application's environment or the external parent.

GetChildren returns an array of object IDs. If the specified object has no children, GetChildren returns NULL.

The GetChildren method also receives a filter argument, which UFT can use to request only a subset of the object's children. The GetChildren method must return all of the object's children whose property values match all of the values specified in the filter.

UFT calls the GetChildren method in various situations, to retrieve information about test object hierarchy. The GetChildren method is also called when a test includes the ChildObjects() test object operation. For example, UFT calls the GetChildren method to return the buttons for the Calculator application when the following steps are run in a UFT GUI test:

Set desc2 = Description.Create() 
desc2("micclass").Value = "WinButton"
Set container2 = Window("Calculator")
Set childObjects2 = container2.ChildObjects(desc2)
MsgBox childObjects2.Count