Web Tables
Practice locating table elements, reading rows and columns, validating employee data and performing dynamic table operations using Selenium WebDriver.
What You Will Practice
- Identify table headers.
- Count rows and columns.
- Read complete table data.
- Find an employee by name.
- Retrieve a particular cell.
- Validate employee salary.
- Edit employee records.
- Delete employee records.
Employee Web Table
Practice locating rows, columns and individual table cells.
| Employee ID | Name | Department | Role | Salary | Status | Action |
|---|---|---|---|---|---|---|
| EMP001 | Arjun Kumar | QA | Automation Engineer | ₹65,000 | Active | |
| EMP002 | Priya Sharma | Development | Java Developer | ₹72,000 | Active | |
| EMP003 | Rahul Verma | Testing | Manual Tester | ₹55,000 | Active | |
| EMP004 | Sneha Reddy | API Testing | API Tester | ₹68,000 | On Leave | |
| EMP005 | Karthik Raj | DevOps | DevOps Engineer | ₹78,000 | Active |
//table[@id='employeeTable']//tbody/tr
Table Operations
Use these controls to understand how Selenium interacts with tables.
Find Employee
Practice identifying a specific employee row from the table.
//table[@id='employeeTable']//tr[td[normalize-space()='Arjun Kumar']]
Validate Employee Salary
Practice retrieving cell values and validating expected results.
Dynamic Table Practice
Add a new employee and observe how the table changes dynamically.
Selenium Web Table Commands
WebElement table =
driver.findElement(
By.id("employeeTable")
);
List<WebElement> rows =
table.findElements(
By.tagName("tr")
);
List<WebElement> cells =
row.findElements(
By.tagName("td")
);
String value = cell.getText();