Highlighted
Absent Member.
Absent Member.
3659 views

UFT is not fetching the exact row count from webtable

I tried to fetch the row count from webtable having approximately 150 rows. however, while getting the row count it is displaying only 25. Below is the syntax i used.

 

1. rowcount=browser().page().webtable().rowcount

2. set Obj=browser().page().webtable()

     rowcount= obj.rowcount

0 Likes
8 Replies
Highlighted
Vice Admiral Vice Admiral
Vice Admiral

What does the table look like? Is it possible that there are 25 rows containing tables or multiple sub-rows?

Highlighted
Absent Member.
Absent Member.

Hello

Try this.

 

rc = Browser("brObj").Page("PgObj").WebTable("TblObj").rowcount
msgbox rc

set m =  Browser("brObj").Page("PgObj").WebTable("TblObj").Object
 msgbox m.rows.length

Highlighted
Absent Member.
Absent Member.

Hi,

 

I have tried the same however, it is still fetching the same count. When ever we scroll down the data in the webtable starts fetching or loading.

0 Likes
Highlighted
Vice Admiral Vice Admiral
Vice Admiral

If the application only renders 25 rows at a time, you may need to capture the data you need from the first 25, scroll down, rinse and repeat.

0 Likes
Highlighted
Absent Member.
Absent Member.

Hi,

 

I have tried the same. However, it is not capturing the data. Could you please help me how can it be done.

0 Likes
Highlighted
Cadet 2nd Class Cadet 2nd Class
Cadet 2nd Class

Webtables will not be designed exactly like rows/columns for which it have data. Always developers will use lot of row/column elements to handle different scenarios, look & feel, etc.

 

So you should know if you are going to accept an row then it must contain some no of minimum cells which will display your values. Fetch the rows and filter based on cells count and operate.

 

intMinCells = 3
For intRow = 0 To Browser().Page().WebTable().Object.rows.length - 1
    If Browser().Page().WebTable().Object.rows(intRow).cells.length > intMinCells Then
        'Now handle the way you want
        msgbox Browser().Page().WebTable().Object.rows(intRow).cells(0).innerText

        'If you need to click some element on a cell - But ensure   'native object's start index is 0 and for ChildItem starts with 1; you 'need to calculate the index based on the table design
        Browser().Page().WebTable().ChildItem(intRow, intCell, "WebButton", 0).Click
        End If
Next

 

Thanks...

Accept as solution/Give Kudos to the author if the piece of information answered/helped you to solve your problem.
All the thoughts here are mine not related to my employer nor anyone.
Test Automation Ecstasy
Highlighted
Absent Member.
Absent Member.

Similar to the last post, I would do a reality check on the text in each row and see what is represented with each row, including any potential hidden rows.


nRows = Browser().Page().WebTable().RowCount

nCol = 1 ' assuming the text is in Column 1

For nRow = 1 to nRows

      msgbox("Row = " & nRow & ".  Text = " & Browser().Page().WebTable().GetCellData(nRow, nCol)

Next

 

Might need to include functionality for scrolling or clicking page numbers or "Next" etc. to get an even better picture.

Highlighted
Vice Admiral Vice Admiral
Vice Admiral

We can throw ideas at this, but it is tough without being able to see the table in question and evaluate its behavior.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.