| Column1 | Column2 | Column3 | Column4 | Column5 | Column6 | Column7 |
| | | | | | |
| | | | | | |
| | | | | | |
hi
I have a search criteria which i have to automate. the search result grid luks lik the above table and to verify the search functionality i need to assert the value present in the column 3rd of all the rows.. At present i have implemented a code where all the values from the table is being read and stored in a list. but i need only the third column value. please help.
my code is
List<WebElement> tr_collection = driver.findElements(By.xpath(".//table[@id='fsConnectorRow']/tbody/tr"));
System.out.println("NUMBER OF ROWS IN THIS TABLE = "+tr_collection.size());
int row_num=1,col_num=1;
for (WebElement trElement : tr_collection)
{
List<WebElement> td_collection = trElement.findElements(By.tagName("td"));
int n = td_collection.size();
for(int i=0;i<td_collection.size();i++)
System.out.println(td_collection.get(i).getText());
System.out.println("NUMBER OF COLUMNS="+td_collection.size());
col_num=1;
for (WebElement tdElement :td_collection)
{
System.out.println("row # " +row_num+ ", col # " +col_num+ "text=" +tdElement.getText());
col_num++;
}
row_num++;
}
I need only 3rd column value please help