Home > Java, Selenium > Selenium RC: count rows in a table

Selenium RC: count rows in a table

While running Selenium tests, if some part of your logic requires you to count the number of rows in a table, we can do this in Java:

getXpathCount(“//xpath/to/the/particular/table/tbody/tr”)

eg:

int numRows = selenium.getXpathCount(“//table/tbody[2]/tr”).intValue();

Advertisement
Categories: Java, Selenium
  1. No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.