Applies to TestComplete 14.20, last modified on September 11, 2019


Objects can have children. For example, windows are children of a process, processes are children of the Sys object, etc. Each object maintains a list of child objects. The Child method of a parent object returns one child object by its index in the list.



TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section
Index [in]    Required    Integer    
Result Object

Applies To

All processes, windows, controls and onscreen objects.

View Mode

To view this method in the Object Browser panel and in other panels and dialogs, activate the Advanced view mode.


The method has the following parameter:


Specifies the zero-based index of the child you want to get.

Result Value

A child object that has the specified index.


The following example demonstrates how to iterate through all child objects of an object. It iterates through the current active window's children in a loop and posts their names to the test log.

JavaScript, JScript

function GetWindowNames()
  var w, i, wndChild;
  w = Sys.Desktop.ActiveWindow();
  Log.Message(w.Name, w.FullName);
  for (i=0; i < w.ChildCount; i++)
    wndChild = w.Child(i);
    Log.Message(wndChild.Name, "", 0);


def GetWindowNames():
  w = Sys.Desktop.ActiveWindow()
  Log.Message(w.Name, w.FullName)
  for i in range ( 0 , w.ChildCount):
    wndChild = w.Child(i)
    Log.Message(wndChild.Name, "", 0)


Sub GetWindowNames
  Set w = Sys.Desktop.ActiveWindow
  For i = 0 To w.ChildCount - 1
    Set wndChild = w.Child(i)
    Log.Message wndChild.Name
End Sub


procedure GetWindowNames;
  i : integer;
  w, wndChild : OleVariant;
  w := Sys.Desktop.ActiveWindow;
  Log.Message(w.Name, w.FullName);
  for i := 0 to (w.ChildCount - 1) do
    wndChild := w.Child(i);
    Log.Message(wndChild.Name, '', 0);

C++Script, C#Script

function GetWindowNames()
  var w, i, wndChild;
  w = Sys["Desktop"]["ActiveWindow"]();
  Log["Message"](w["Name"], w["FullName"]);
  for (i=0; i < w["ChildCount"]; i++)
    wndChild = w["Child"](i);
    Log["Message"](wndChild["Name"], "", 0);

See Also

ChildCount Property
WaitChild Method
Find Method
FindChild Method
FindAll Method
FindAllChildren Method
FindId Method
Refresh Method

Highlight search results