How to get row count for a table

Best practices, code snippets for common functionality, examples, and guidelines.
Posts: 86
Joined: Mon Aug 05, 2019 10:46 pm

How to get row count for a table

Post by qa-auto » Tue Nov 05, 2019 10:41 pm


There are so many posts on this issue. Even still, it took me awhile this afternoon to get the row count on my table. Sharing this forward in case it can be a quick solution for someone else.

Table structure
Annotation 2019-11-05 153024.jpg
Repository element RxPath

public static int TableRowCount(Adapter element)
TBodyTag tbody = new TBodyTag(element);
int rowCount = tbody.Children.Count;
Report.Info("User", "Table size: " + (rowCount - 1).ToString());
// header is first row so subtract 1
return (rowCount - 1);

The KEY thing is to add '/tbody' to your RxPath.

Hope this is helpful!
You do not have the required permissions to view the files attached to this post.