Forum Discussion

Madhi's avatar
Madhi
Contributor
15 years ago

Count the no. of objects on a window

I am working on a desktop application.  I need to count the no. of checkboxes on the screen.  Is there a way to do it?

My object reference looks like:



Sys.Process("something").WPFObject("HwndSource: somethingelse").WPFObject("somethingelse").WPFObject("LayoutRoot").WPFObject("stckPnl").WPFObject("bdrTeamMembers").WPFObject("wndAddNewUser").WPFObject("StackPanel", "", 1).WPFObject("Border", "", 1).WPFObject("StackPanel", "", 1).WPFObject("sbMembers").WPFObject("xdgMember").WPFObject("Grid", "", 1).WPFObject("RecordListControl", "", 1).WPFObject("DataRecordPresenter", "", 3).WPFObject("DockPanel", "", 1).WPFObject("DataRecordCellArea", "", 1).WPFObject("VirtualizingDataRecordCellPanel", "", 1).WPFObject("CellValuePresenter", "", 1)
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Read up on the "FindAllChildren" method that TestComplete attaches to objects.  You can pass in as a parameter the class (wildcarded if you want) and it returns an array of all objects found that match your parameters.  You can then use VarArrayHighBound to get the count.