After further investigation.
I had to identify 3 elements: The dropdownbox, allOptions in the dropdownbox and inputTextbox in the dropdownbox.
I created this method to solve the issue
public static void selectItemInDropdownBox(WebElement dropdownbox,WebElement inputSearch,List<WebElement> allOptionsList,String selectedItem){
//Wait for dropdownbox to display on page
browser.ExplicitWait(dropdownbox);
//Now Click on dropdownbox to show the inputTextbox and allOptions
dropdownbox.click();
// Must now wait for allOptions to display
browser.ExplicitWait(inputSearch);
// Type now the searched Item
inputSearch.sendKeys(selectedItem);
//Now if the search item has more than 1 returned item then we need to select the correct one
int counter = 0;
for ( WebElement i: allOptionsList) {
if ( i.getText().trim().equals( selectedItem ) ) {
allOptionsList.get(counter).click();
break;
}
counter++;
}
}
Here are my Explicit Waits : First one is for WebElement and second one is for a list
public static void ExplicitWait( WebElement WebElement){
(new WebDriverWait(driver,10)).until(ExpectedConditions.elementToBeClickable(WebElement));}
public static void ExplicitWaitList(List<WebElement> listWebElement){
(new WebDriverWait(driver,10)).until(ExpectedConditions.visibilityOfAllElements(listWebElement));
}