# Row count of table

**URL:** <https://www.ruby-forum.com/t/row-count-of-table/111458>\
**Category:** Ruby\
**Created:** [August 7, 2007, 3:55pm UTC](https://www.ruby-forum.com/t/row-count-of-table/111458 "2007-08-07T15:55:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vanivk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/858c86/32.png) [@vanivk](https://www.ruby-forum.com/u/vanivk)\
**Post date:** [August 7, 2007, 3:55pm UTC](https://www.ruby-forum.com/t/row-count-of-table/111458/1 "2007-08-07T15:55:28Z")

</div>

Hello all,  
I am stuck up in finding the row count of a table in a HTML page through  
Watir script. I am using row\_count() function to find the number of rows  
in the table. Its returning me incorrect number of rows in the table. I  
tried accessing the table through xpath, since I did not have attribute  
associated with the table. Following is the HTML of the table [obtained  
through IE developer bar] whose row count I need:

|
| |
|
| |

The row\_count() for the table inside the

 gives as 9, instead of 2.  
I am using the following xpath :  
$ie.table(:xpath,  
“//td[@id=‘ctl00\_ContentPlaceHolder1\_dtGridEmployees\_dom’]/table”).row\_count()

Am I going wrong anywhere? Please let me know.

Thanks,  
Vani

---

<div class="post-metadata">

**Author:** ![vanivk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/858c86/32.png) [@vanivk](https://www.ruby-forum.com/u/vanivk)\
**Post date:** [August 7, 2007, 7:05pm UTC](https://www.ruby-forum.com/t/row-count-of-table/111458/2 "2007-08-07T19:05:31Z")

</div>

On Aug 7, 7:56 am, Vani K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Vani -- Posted viahttp://www.ruby-forum.com/.

you should post this to the watir group (  
[http://groups.google.ca/group/watir-general?lnk=srg](http://groups.google.ca/group/watir-general?lnk=srg)  
)  
I think the problem you are having is because of nested tables

Paul
