I have a test case that requires typing in a partial value into an ajax based textfield and verifying the list has the expected content. If it does, select the content. An
There are few answers with code here. So, I will do my contribution.
The code that I'm using to select an item in the autocomplete component from PrimeFaces 2.2:
driver.findElement(By.id(codigoBanco_input)).sendKeys("text");
waitForElementLocated(By.cssSelector(listItensSelector), 5);
List listItems = driver.findElements(By.cssSelector(listItensSelector));
Actions builder = new Actions(driver);
builder.moveToElement(listItems.get(0)).build().perform();
WebDriverWait wait = new WebDriverWait(driver, 5);
wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector(itemSelector)));
driver.findElement(By.cssSelector(itemSelector)).click();