Get Row Number With Cell Text in LeanFT | UFT Developer

While testing a web application we very often validate the contents of a web table. Here we will take a look at how to get row number with cell text in LeanFT ( UFT Developer ) for a particular column of a web table. For example, you are submitting a form after entering some details and when the form is submitted the records are added in the last row of a web table. Now you will have to validate all the records of the newly added row. In such a scenario finding the required row number with the specific is the most efficient way rather than iterating the whole table.

In this article, I have shown how to retrieve the row number of a table cell having a particular value in the desired column. The following is a web table having three columns. We will retrieve the row number of the cell in column number two having value Roland Mendel as highlighted in the screenshot.

Get Row Number With Cell Text in LeanFT

Get Row Number With Cell Text in LeanFT-Example

Code Explanation

We have passed two parameter values in the findRowWithCellTextInColumn method. The first is the text that we are looking for in the table and the second parameter value is the column number where the value should be searched in the web table. The column indexing starts with 0 and in the above example, we are looking for the required value in column 2 that is why we have passed column value as 1.

You can also refer to my post on UFT Developer | LeanFT Get Table Cell Values for all Rows of a Column to know how to retrieve all cell values for the specified column.

Recommended Posts

Leave a Reply