I got the contents of a list (ul) using xpath and put it in a variable of type List . Then I looped the variable elements and had them print the contents of the list.
The eclipse displayed the list with all the options contained in the list (li). Inside the loop I made an IF to look for the GEOCF option and, if it is found, the script will click. Even the GEOCF option exists, I can not click on it and the routine goes to the ELSE.
It follows the source code and the print of the images.
public void selecionarAuditoriaNacional() throws Exception {
WebElement findElement = driver.findElement(By.id("consultarUnidadeAuditoria"));
findElement.click();
List<WebElement> elementos = driver.findElements(By.xpath("//div[@class = 'ui-selectonemenu-items-wrapper']/ul"));
for (WebElement elementosGrid : elementos) {
System.out.println(elementosGrid.getText());
if (elementosGrid.equals("GEOCF")) {
elementosGrid.click();
} else {
System.out.println("Erro");
}
}
}

