Tricentis Tosca 16.0 Released on Feb-2023 ----- UFT has been upgraded from UFT 15.0.1 to UFT One 15.0.2, Beginning at November 2020.

Friday, 23 November 2018

Difference between Child object, ChildItem and GetCellData

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

Note: only a member of this blog may post a comment.