@Test public void testSetValueListLayout() throws Exception { HtmlPage page = environment.getPage("/autocompleteListLayoutTest.jsf"); HtmlElement autocompleteList = page.getElementById("form:myAutocompleteList"); Assert.assertNotNull(autocompleteList); List<?> countryList = autocompleteList.getByXPath("div/div/div/ul/li"); Assert.assertEquals(30, countryList.size()); HtmlInput input = (HtmlInput) page.getElementById("form:myAutocompleteInput"); Assert.assertNotNull(input); input.type("be"); for (int i = 0; i < 20; i++) { synchronized (page) { autocompleteList = page.getElementById("form:myAutocompleteList"); Assert.assertNotNull(autocompleteList); countryList = autocompleteList.getByXPath("div/div/div/ul/li"); if (countryList.size() == 5) { break; } else { page.wait(500); } } } Assert.assertEquals(5, countryList.size()); }