public void testAjax() {
Selenium selenium = getSelenium();
testAppFunctionalPage("/components/foreach/forEach.jsf");
ForEachInspector forEach = forEach("formID:fe10");
SuggestionFieldInspector suggestionField = suggestionField(forEach.item(0, "sf1").asSeleniumLocator());
ElementInspector dropDownItem0 = suggestionField.popup().items().get(0);
ElementInspector dropDownItem1 = suggestionField.popup().items().get(1);
ElementInspector dropDownItem2 = suggestionField.popup().items().get(2);
dropDownItem0.assertElementExists(false);
dropDownItem1.assertElementExists(false);
dropDownItem2.assertElementExists(false);
suggestionField.keyPress('a');
OpenFacesAjaxLoadingMode.getInstance().waitForLoad();
dropDownItem0.assertVisible(true);
dropDownItem1.assertVisible(true);
dropDownItem2.assertVisible(true);
dropDownItem0.click();
sleep(200);
selenium.submit("formID");
waitForPageToLoad();
dropDownItem0.assertElementExists(false);
dropDownItem1.assertElementExists(false);
dropDownItem2.assertElementExists(false);
suggestionField = suggestionField(forEach.item(1, "sf1").asSeleniumLocator());
dropDownItem0 = suggestionField.popup().items().get(0);
dropDownItem1 = suggestionField.popup().items().get(1);
dropDownItem2 = suggestionField.popup().items().get(2);
dropDownItem0.assertElementExists(false);
dropDownItem1.assertElementExists(false);
dropDownItem2.assertElementExists(false);
sleep(3000);
suggestionField.keyPress('a');
OpenFacesAjaxLoadingMode.getInstance().waitForLoad();
dropDownItem0.assertVisible(true);
dropDownItem1.assertVisible(true);
dropDownItem2.assertVisible(true);
dropDownItem2.click();
sleep(200);
selenium.submit("formID");
waitForPageToLoad();
dropDownItem0.assertElementExists(false);
dropDownItem1.assertElementExists(false);
dropDownItem2.assertElementExists(false);
suggestionField = suggestionField(forEach.item(2, "sf1").asSeleniumLocator());
dropDownItem0 = suggestionField.popup().items().get(0);
dropDownItem1 = suggestionField.popup().items().get(1);
dropDownItem2 = suggestionField.popup().items().get(2);
dropDownItem0.assertElementExists(false);
dropDownItem1.assertElementExists(false);
dropDownItem2.assertElementExists(false);
suggestionField.keyPress('a');
OpenFacesAjaxLoadingMode.getInstance().waitForLoad();
dropDownItem0.assertVisible(true);
dropDownItem1.assertVisible(true);
dropDownItem2.assertVisible(true);
dropDownItem1.click();