Get Specific Table Cell Value
You can navigate to a specific cell using row and column indices or by element IDs.
The employee table has cells with IDs like emp1Name, emp3Dept, etc.
Table Cell ID Pattern:
<table id="employeeTable">
<tbody>
<tr>
<td id="emp1Name">John Smith</td>
<td id="emp1Age">30</td>
<td id="emp1Dept">Engineering</td>
<td id="emp1Salary">$80,000</td>
</tr>
<tr>
<td id="emp2Name">Jane Doe</td>
<td id="emp2Age">25</td>
<td id="emp2Dept">Marketing</td>
<td id="emp2Salary">$65,000</td>
</tr>
<!-- Pattern: emp{N}Name, emp{N}Age, emp{N}Dept, emp{N}Salary -->
</tbody>
</table>
Task:
- Navigate to
https://testkru.com/Elements/Tables
- Get the name of employee 1 (John Smith)
- Get the department of employee 3 (Sales)
- Get the salary of employee 4 ($85,000)
Expected output:
Employee 1 Name: John Smith
Employee 3 Dept: Sales
Employee 4 Salary: $85,000