List<WebElement> rows = driver.findElements( By.xpath("//table/tr")); System.out.println( rows.size());
Use dynamic XPath and iterate rows.