One way to do it is to Assert that row n exists while row n+1 does not exists with xpath, something like :
assertElementPresent | //table[@id='mytable']/tr[10] | |
assertElementNotPresent | //table[@id='mytable']/tr[11] | |
to verify table with id mytable does not have 10 elements
Another way is to use the storeassertXpath extension to count columns
assertXpath | count(//table[@id='mytable']/tr) | 10

Comments (2)
Jun 13, 2008
jburrow says:
Here i am using GetXpathCount() and xpath to identify the row collection of the ...Here i am using GetXpathCount() and xpath to identify the row collection of the named ("mytable") table.
Assert.AreEqual(3,selenium.GetXpathCount("xpath=id('mytable')/tbody/tr"),"Expected 3 rows in table");
Here i am asserting my table contains 3 rows (including heading)
Jun 16, 2009
cyberwolf says:
Note that you need to use the tbody element, ...table/tbody/tr, even if it's not...Note that you need to use the tbody element, ...table/tbody/tr, even if it's not in your HTML code. It's an implicit element that is added by your browser when it builds up the DOM tree of your HTML page.
(I only tested that on Firefox, but I guess IE and others behave the same)