RE: how to get td (pending) value in this table data.I wrote some code to fetch rows But Total rows is 0 While Im running :Can u please provide some code.


<input type=”checkbox” name=”data[399]” id=”checker”>
<td>9/23/2014 9:43:34</td>
<td><a onclick=”DoPost(399,0);”>View Profile</a></td>

surekha Train Asked on September 24, 2014 in Selenium WebDriver.
Add Comment
1 Answers
Best answer

Hi Surekha,

Please try this code.

WebElement Webtable=driver.findElement(“TableID”)); // Replace TableID with Actual Table ID or Xpath
List<WebElement> TotalRowCount=Webtable.findElements(By.xpath(“//*[@id=’TableID’]/tbody/tr”));
System.out.println(“No. of Rows in the WebTable: “+TotalRowCount.size());

// Now we will Iterate the Table and print the Values
int RowIndex=1;
for(WebElement rowElement:TotalRowCount)
List<WebElement> TotalColumnCount=rowElement.findElements(By.xpath(“td”));
int ColumnIndex=1;
for(WebElement colElement:TotalColumnCount)
System.out.println(“Row “+RowIndex+” Column “+ColumnIndex+” Data “+colElement.getText());


Doctor Answered on September 24, 2014.

Put an if condition after you get the column data according to your need.

on September 24, 2014.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.