Count Table Rows and Columns
Count rows using <tr> in <tbody> and columns using <th> or <td> in the first row.
Table Structure (thead vs tbody):
<table id="employeeTable">
<thead> <!-- Header section -->
<tr>
<th>Name</th><th>Age</th><th>Department</th><th>Salary</th>
</tr>
</thead>
<tbody> <!-- Data section (count rows here) -->
<tr><td>John Smith</td><td>30</td><td>Engineering</td><td>$80,000</td></tr>
<tr><td>Jane Doe</td><td>25</td><td>Marketing</td><td>$65,000</td></tr>
<!-- ... 5 rows total ... -->
</tbody>
</table>
Task:
- Navigate to
https://testkru.com/Elements/Tables
- Count the number of data rows (in tbody) in the employeeTable
- Count the number of columns (headers)
- Print both counts
Expected output:
Data rows: 5
Columns: 4