Below code can be used to get rowcount from a Html table. If table not exists returns -1.
private int getRowCount(By by) throws Exception {
try {
WebElement table = driver.findElement(by);
List rows = table.findElements(By.tagName("tr"));
return rows.size();
} catch (Exception e) {
return -1;
}
}
private int getRowCount(By by) throws Exception {
try {
WebElement table = driver.findElement(by);
List
return rows.size();
} catch (Exception e) {
return -1;
}
}
No comments:
Post a Comment