3.2.0

Does QTP10 handles ActiveWidget Grids?

Hi,

I am working on a java web application which has Activewidget grids. I am using QTP10.0 to automate it. I have to get all the cells dynamic huge data and need to export them into an excel and veriify in other application. Please help me how to resolve this issue.


I really appreciate your help..


Thanks,
Sari
Sari
November 19,
QTP10.0 is not recognizing the grid as WebTable and the data in grid is recognized as webelement.
Sari
November 19,
Does anybody have any idea how to handle activewidget grid using QTP10.0. It's not recognizing, the data in grid is recognized as webelement. If anyone has the same issue and have a solution please do reply to this message.

Appreciate your help!!
Sari
November 22,
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
***********************************************

Sari
December 10,

This topic is archived.

See also:


Back to support forum