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.
2. set Obj=browser().page().webtable()
rc = Browser("brObj").Page("PgObj").WebTable("TblObj").rowcount
set m = Browser("brObj").Page("PgObj").WebTable("TblObj").Object
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
All the thoughts here are mine not related to my employer nor anyone.
Test Automation Ecstasy
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)
Might need to include functionality for scrolling or clicking page numbers or "Next" etc. to get an even better picture.