Wikipedia

Search results

Thursday, 7 August 2014

Get total number of rows from a HtmlTable – Webdriver

public static int getRowCount(WebElement element) throws Exception {
try {
WebElement table =element;
@SuppressWarnings(“rawtypes”)
List rows = table.findElements(By.tagName(“tr”));
return rows.size();
} catch (Exception e) {
return -1;
}

No comments:

Post a Comment