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

Parents Reply Children
  • 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.

  • 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.

  • Hi,

     

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

  • 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...

  • 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.

  • 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.

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