HP Technical support helped me to get the solution. I was able to get the number of rows and columns for the
http://www.activewidgets.com/grid/.
HP technical support gave me two versions of the function, one that print the data on the QTP print log and another one that enter the data on the datatable.All you need to do is update the ids of the objects to make them fit to your application.
******************************************
The first version (QTP print log):
' 'parent' is a browser and page where it points to. For this specific example it is Browser("ActiveWidgets").Page("ActiveWidgetsGrid")
Function get_all(parent)
Cols=0
Rows=0
Set oDescScroll = Description.Create() ' Description of the scrolling container
oDescScroll("micclass").Value = "WebElement"
oDescScroll("html id").Value = "aw37-scroll-box"
oDescScroll("html tag").Value = "SPAN"
Set oDescRows = Description.Create() ' Description of the collection if rows
oDescRows("micclass").Value = "WebElement"
oDescRows("html id").Value = "aw37-row-[0-9]+"
oDescRows("html tag").Value = "SPAN"
Set oDescCells = Description.Create() ' Description of the collection if cells
oDescCells("micclass").Value = "WebElement"
'oDescCells("html id").Value = "aw37-cell-[0-9]+-"
oDescCells("html tag").Value = "SPAN"
Set oDescCell = Description.Create() ' Description of a single cell
oDescCell("micclass").Value = "WebElement"
'oDescCells("html id").Value = "aw37-cell-
oDescCell("html tag").Value = "SPAN"
Set oDescRow = Description.Create() ' Description of a single row
oDescRow("micclass").Value = "WebElement"
'oDescRow("html id").Value = "aw37-row-"
oDescRow("html tag").Value = "SPAN"
parent.WebElement(oDescScroll).Object.scrollTop = parent.WebElement(oDescScroll).Object.scrollHeight ' scroll to the bottom
parent.WebElement(oDescScroll).Object.scrollLeft = parent.WebElement(oDescScroll).Object.scrollWidth ' scroll to the left
wait 1
set ObjRows= parent.ChildObjects(oDescRows) ' get number of rows
If ObjRows.count>0 Then
rows= cint (split (ObjRows(ObjRows.count-1).object.id,"-")(2) )+1
End If
' get number of cells of last row
oDescCells("html id").Value ="aw37-cell-[0-9]+-"& (rows-1)
set ObjCells=ObjRows(ObjRows.count-1).ChildObjects(oDescCells)
If ObjCells.count>0 Then
cols = cint (split (ObjCells(ObjCells.count-1).object.id,"-")(2) )+1
End If
parent.WebElement(oDescScroll).Object.scrollTop = 0 ' go back to the beginning of the grid
parent.WebElement(oDescScroll).Object.scrollLeft =0
wait 1
' iterate thru rows and columns
rowText=""
rowsHeight=0
For i=0 to rows-1
cellsWidth=28
oDescRow("html id").Value = "aw37-row-"&i
rowsHeight= rowsHeight+parent.WebElement(oDescRow).getROproperty("height") ' calculate to move to next row
For j=0 to cols-1
oDescCell("html id").Value = "aw37-cell-"&j&"-"&i&""
cellsWidth= cellsWidth +parent.WebElement(oDescCell).getROproperty("width") ' calculate to move to next cell
rowText= rowText&" | "&parent.WebElement(oDescCell).object.innerText
parent.WebElement(oDescScroll).Object.scrollLeft =cellsWidth
next
print rowText
rowText=""
parent.WebElement(oDescScroll).Object.scrollLeft =0 go back to the beginning of cell (horizontal scroll)
parent.WebElement(oDescScroll).Object.scrollTop = rowsHeight move to next row (vertical scroll)
wait 1
Next
End function
***********************************************
***********************************************
And here the version that updates the data table:
Function getAllToDataTable(parent,sheetName)
Cols=0
Rows=0
dataTable.AddSheet sheetName
Set oDescScroll = Description.Create() ' Description of the scrolling container
oDescScroll("micclass").Value = "WebElement"
oDescScroll("html id").Value = "aw37-scroll-box"
oDescScroll("html tag").Value = "SPAN"
Set oDescRows = Description.Create() ' Description of the collection if rows
oDescRows("micclass").Value = "WebElement"
oDescRows("html id").Value = "aw37-row-[0-9]+"
oDescRows("html tag").Value = "SPAN"
Set oDescCells = Description.Create() ' Description of the collection if cells
oDescCells("micclass").Value = "WebElement"
'oDescCells("html id").Value = "aw37-cell-[0-9]+-"
oDescCells("html tag").Value = "SPAN"
Set oDescCell = Description.Create() '' Description of a single cell
oDescCell("micclass").Value = "WebElement"
'oDescCells("html id").Value = "aw37-cell-
oDescCell("html tag").Value = "SPAN"
Set oDescRow = Description.Create() ' 'escription of a single row
oDescRow("micclass").Value = "WebElement"
'oDescRow("html id").Value = "aw37-row-"
oDescRow("html tag").Value = "SPAN"
parent.WebElement(oDescScroll).Object.scrollTop = parent.WebElement(oDescScroll).Object.scrollHeight ' scroll to the bottom
parent.WebElement(oDescScroll).Object.scrollLeft = parent.WebElement(oDescScroll).Object.scrollWidth ' scroll to the left
wait 1
set ObjRows= parent.ChildObjects(oDescRows) ' get number of rows
If ObjRows.count>0 Then
rows= cint (split (ObjRows(ObjRows.count-1).object.id,"-")(2) )+1
End If
' get number of cells of last row
oDescCells("html id").Value ="aw37-cell-[0-9]+-"& (rows-1)
set ObjCells=ObjRows(ObjRows.count-1).ChildObjects(oDescCells)
If ObjCells.count>0 Then
cols = cint (split (ObjCells(ObjCells.count-1).object.id,"-")(2) )+1
End If
parent.WebElement(oDescScroll).Object.scrollTop = 0 ' go back to the beginning of the grid
parent.WebElement(oDescScroll).Object.scrollLeft =0
wait 1
' iterate thru rows and columns
rowText=""
rowsHeight=0
For i=0 to rows-1
cellsWidth=28
oDescRow("html id").Value = "aw37-row-"&i
rowsHeight= rowsHeight+parent.WebElement(oDescRow).getROproperty("height") ' calculate to move to next row
dataTable.GetSheet(sheetName).SetCurrentRow i+1
For j=0 to cols-1
oDescCell("html id").Value = "aw37-cell-"&j&"-"&i&""
cellsWidth= cellsWidth +parent.WebElement(oDescCell).getROproperty("width") ' calculate to move to next cell
If i=0 Then
dataTable.GetSheet(sheetName).AddParameter "Col"&j,""
End If
dataTable.Value("Col"&j,sheetName)=parent.WebElement(oDescCell).object.innerText
parent.WebElement(oDescScroll).Object.scrollLeft =cellsWidth ' move to next cell (horizontal scroll)
next
parent.WebElement(oDescScroll).Object.scrollLeft =0 ' go back to the beginning of cell (horizontal scroll)
parent.WebElement(oDescScroll).Object.scrollTop = rowsHeight ' move to next row (vertical scroll)
wait 1
Next
End function
***********************************************