I have a table of four columns. The data in the first column is a name of a group in which I can click on to go to a new page to modify the group data.
I can get the text of that group name, but I am unable to click on it. I’m trying to go through each row and get the status of each group (located in column 4). If it’s on hold, I want to modify the data of that group.
Here is my code: Why will it not click on the group name?
List<WebElement> elems = driver.findElements(By.xpath("//table[@id='nameOfTable']/tbody/tr"));
for (WebElement rowElem : elems)
{
List<WebElement> cells = rowElem.findElements(By.xpath("td"));
if(cells.get(3).getText().equalsIgnoreCase("Hold"))
{
System.out.println(cells.get(0).getText()); //
cells.get(0).click; // This will not click on the link
}
}
You would need to say
cells.get(0).click();.I believe you are missing a couple of parentheses…