How to operate with WebTable
What is a WebTable?
A WebTable is an HTML table (<table>) containing rows (<tr>) and cells (<td>), commonly seen in data grids, reports, or search results.
Basic Approach
List<WebElement> rows = driver.findElements(By.xpath("//table/tbody/tr"));
for (WebElement row : rows) {
List<WebElement> cells = row.findElements(By.tagName("td"));
System.out.println(cells.get(0).getText());
}
Why This Matters
Iterating through rows and cells lets a test verify specific data values, count matching rows, or locate a row based on its content (like finding the row for a specific username).
PreviousValidation Commands: isSelected, isEnabled, isDisplayed
Next How to Handle Alerts in webpage
Ready to master real-world software testing?
Learn manual and automation testing hands-on with mentor-led sessions.
.png)