← Back to Selenium Practice

Web Table Handling

Practice UI

ID Name Role
101 John Tester
102 David Automation Engineer
List<WebElement> rows =
driver.findElements(
By.xpath("//table/tr"));

System.out.println(
rows.size());

Interview Question

How to handle dynamic web tables?

Use dynamic XPath and iterate rows.