Applies to TestComplete 14.10, last modified on June 5, 2019


Objects can have one or more children. For instance, processes are children of the Sys object, windows are children of processes, and so on. The ChildCount property of an object returns the number of its direct children. Use this property to iterate through the list of child objects.



Read-Only Property Integer
TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section

Applies To

All processes, windows, controls and onscreen objects.

View Mode

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

Property Value

The number of child objects of the current object.


The child objects list can change dynamically. In this case, you can use the Refresh method of the tested object to update the actual list of its child objects.


The following code inserts two messages. The first message holds the name of the active window, the second one - the names of all of its child objects.

JavaScript, JScript

function TestProc()
  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 TestProc():
  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 TestProc
  Set w = Sys.Desktop.ActiveWindow
  For i = 0 To w.ChildCount - 1
    Set wndChild = w.Child(i)
    Log.Message wndChild.Name
End Sub


procedure TestProc;
  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 TestProc()
  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

Child Method
Refresh Method

Highlight search results