Difference between ChildObjects and ChildItem in UFT

Whether it is a web-based application or a windows based application each object (text box, button, list box, checkbox, radio button, hyperlinks, etc) belongs to a class of Object. There are two methods in UFT with the name ChildObjects and ChildItem and people often got confused about their functionalities as the names are quite similar. So let me clear your doubt about the difference between ChildObjects and ChildItem in UFT.

The ChildObjects method is used to retrieve a collection of objects for a specific type of object class. For example, you might come across a scenario wherein you need to count all checkboxes on a page and select all of them. In order to retrieve a collection of the object of a particular class, we need to create a description of the required object. We have to use descriptive programming to create a description of the object.

Difference between ChildObjects and ChildItem in UFT

Example of ChildObjects in UFT

The following code can be used to find all checkboxes on a page and click them one by one.

Example of ChildItem in UFT

The ChildItem method is used to access the required child object from a web table cell without using a description object. Unlike ChildObjects, it returns only one object at a time.

Syntax
object.ChildItem(Row, Column, MicClass, Index) where Index starts from 0.

Example: There is a web table and each table cell is having multiple hyperlinks inside it. Suppose you have to click the second hyperlink in the third row and first column of a web table cell. The following code can be used.

ChildItem VS GetCellData

Getcelldata method is to retrieve data from a web table cell whereas a ChildItem returns a test object from the cell by type and index as shown in the above example
Syntax
object.GetCellData (Row, Column)
Example of GetCellData

Recommended Posts