I have a drop down list that I cannot select an item from. I can loop through all the items in the list and find the one I want but the click() does not select the item.
Here is the code. Can any one help?
driver.findElement(By.id("components-multi-select")).findElement(By.className("icon")).click(); driver.findElement(By.id("components-suggestions")); List<WebElement> componentList = driver.findElements(By.className("aui-list-item")); for (WebElement component : componentList){ System.out.println(component.getText()); if (component.getText().contains(newComponent)){ component.click(); break; } else{ System.out.println("not equal"); }
Here is the html code of the component drop down list.
<div class="field-group aui-field-componentspicker frother-control-renderer" > <label for="components">Component/s</label> <div class="ajs-multi-select-placeholder textarea long-field"></div> <select class="select hidden " id="components" multiple="multiple" name="components" size="5" data-remove-null-options="true"> <option value="-1"> Unknown </option> <option selected="selected" title="Component 1 - A test component" value="10240"> Component 1 </option> <option title="Component 2 - " value="10242"> Component 2 </option> <option title="Lee 2 " value="10371"> Lee 2 </option> <option title="Roy " value="10370"> Roy </option> <option title="Test Documentation " value="10241"> Test Documentation </option> </select>