Tuesday 7 January 2014

UFT/QTP- Difference between ChildObjects, ChildItem and Getcelldata in QTP





childitem method syntax in qtp, childobjects and child items in qtp, childobjects syntax in qtp, getcelldata method in qtp, getcelldata qtp example


ChildObjects method is to access total child objects from an object using description object. In other words, it returns the collection of child objects contained within the object.

Syntax:- object.ChildObjects ([Description])

eg: for the count of No of links present in a page we can use Child objects method

set odesc = Description.Create()
odesc("Class Name").Value = "oLinks"
set oLinks=Browser("title:=.*").Page("title:=.*").ChildObjects("odesc")
msgbox oLinks.count
  
ChildItem method is to access child objects from a web table cell in web table object without using description object. In other words, it returns a test object from the cell by type and index.

Syntax:-object.ChildItem (Row, Column, MicClass, Index)

EG:

set a = Browser("A").Page("B").WebTable("C").WebTable("Item").ChildItem(2,2,"WebElement",0)
b = a.GetROProperty("value")
MsgBox b

Getcelldata method is to retrieve data from a web table cell in web table object.

Syntax:-object.GetCellData (Row, Column)

EG:

Dim i,j
For i=1 to Row count
  For j=1 to column count

     msgbox browser("Yahoo! Mail: The best").Page("Yahoo! Mail: The best").WebTable("Yahoo! ID:").GetCellData (i,j)

  Next
Next

No comments:

Post a Comment