My Webdriver method is not reliable when clicking an 'Item' stored inside a Dropdown Menu?
For example 10 tests will pass but one will fail (Example image listed below)
My Code:
    public void selectTitleFromDropdownMenu(WebElement dropdown, String textToSearchFor) throws Exception {
    Wait<WebDriver> tempWait = new WebDriverWait(this.driver, 30);
    try {
        tempWait.until(ExpectedConditions.elementToBeClickable(dropdown));
        List<WebElement> options = dropdown.findElements(By.tagName("option"));
        Select selectDropdown = new Select(dropdown);
        for (int i = 0; i < options.size(); i++) {
            if (options.get(i).getText().equals(textToSearchFor))
                this.wait.until(ExpectedConditions.visibilityOf(options.get(i)));
                selectDropdown.selectByVisibleText(textToSearchFor);
        }
        System.out.println("Successfully selected the following text: " + textToSearchFor + ", using the following webelement: " + "<" + dropdown.toString() + ">");
        } catch (Exception e) {
            System.out.println("Unable to select the following text: " + textToSearchFor + ", using the following WebElement: " + "<" + dropdown.toString() + ">");
            System.out.println("Exception: " + e.getMessage());
        }
    }
Even the following Code Fails:
    public void selectTitleFromDropdownMenu(WebElement dropdown) throws Exception {
    Wait<WebDriver> tempWait = new WebDriverWait(this.driver, 30);
    try {
        tempWait.until(ExpectedConditions.visibilityOf(dropdown));
        WebElement mySelectElm = dropdown;
        Select mySelect= new Select(mySelectElm);
        mySelect.selectByVisibleText("Mr.");
Element:
<select class="form-control title ng-touched ng-dirty ng-valid-parse ng-valid ng-valid-required" name="Salutation" ng-model="AddingDelivery.EditingDeliveryAddress.Title" ng-options="salut.id as salut.id for salut in Salutations" required="">
<option class="ng-binding" value="">Please select</option>
<option value="0" label="Mr.">Mr.</option>
<option value="1" label="Miss">Miss</option>
<option value="2" label="Mrs.">Mrs.</option>
<option value="3" label="Ms.">Ms.</option>
<option value="4" label="Dr.">Dr.</option>
</select
Exceptions: the only exceptions I would see are timeout exceptions, for example unable to locate element after 15Seconds...
thanks for your help
