We had similar problem where the options within drop down was fetched from a third party service, which sometimes was a slower operation.
Select select = new Select(driver.findElement(cssSelector("cssSelectorOfSelectBox")));
waitUnitlSelectOptionsPopulated(select)
here is the definition for waitUnitlSelectOptionsPopulated
private void waitUntilSelectOptionsPopulated(final Select select) {
new FluentWait<WebDriver>(driver)
.withTimeout(60, TimeUnit.SECONDS)
.pollingEvery(10, TimeUnit.MILLISECONDS)
.until(new Predicate<WebDriver>() {
public boolean apply(WebDriver d) {
return (select.getOptions().size() > 1);
}
});
}
Note: A check of select.getOptions().size() >1 was needed in our case as we had one static option always displayed.