public void ReadTableData(String sTableID)
{
WebElement table = driver.findElement(By.id(sTableID)));
// Now get all the TR elements from the table
List allRows = table.findElements(By.tagName("tr"));
// And iterate over them, getting the cells
for (WebElement row : allRows) {
List cells = row.findElements(By.tagName("td"));
for (WebElement cell : cells) {
Object CellValue = cell.getText();
System.out.Println("Cellvalue" +Cellvalue.toString )
}
}
}
{
WebElement table = driver.findElement(By.id(sTableID)));
// Now get all the TR elements from the table
List
// And iterate over them, getting the cells
for (WebElement row : allRows) {
List
for (WebElement cell : cells) {
Object CellValue = cell.getText();
System.out.Println("Cellvalue" +Cellvalue.toString )
}
}
}
2 comments:
Good One, thanks.
for (WebElement row : allRows)
Above line gives ERROR, Type Mismatch- Can not Convert Object to Webelement . Any solution
Post a Comment