TestProject Forum

How to get number of rows in a dynamic table

I am trying to get numbers of rows in a dynamic table and pick last row first cell text
Any suggestions really helpful.


Hello @satyavathi.puvvula,

Is your table based on HTML table tags? is it a customized table built on different HTML elements (div, lists, etc.)?

Here is a way you can do it on a table based on HTML table tags:

The flow will be:
Get the number of rows, parameterize the XPath of the last row first cell to get its text.

  1. Get the number of rows using the “Count Elements” action, the XPath //tr will capture all the rows of the table, store the output value in a parameter for further use.

  1. Get the text of the last row first cell using the “Get Text” action, capture the element using a parameterized XPath, indexed by the parameter we created above.

For example: //tr[{rows}]/td[1]

//tr[{rows}] - will capture the last row using the “rows” parameter (which stores the count of the table rows)
td[1] - will capture the first call of the parent row.

i mage

You can use the same implementation of parameterizing XPaths for capturing dynamic elements of different tables.

Thank You. It resolved my problem