cancel
Showing results for 
Search instead for 
Did you mean: 

Count the no. of objects on a window

Madhi
Contributor

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)
1 REPLY 1
tristaanogre
Community Hero

RE: Count the no. of objects on a window

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.

Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
New Here?
Join us and watch the welcome video:
Announcements