How can I select an item Option 3 in drop down as below?
<span class="k-widget k-dropdown k-header form-control required" style="padding: 0px;" unselectable="on" role="listbox" aria-haspopup="true" aria-expanded="true" tabindex="0" aria-owns="assignee_listbox" aria-disabled="false" aria-readonly="false" aria-busy="false" aria-activedescendant="assignee_option_selected">
<span class="k-dropdown-wrap k-state-default" unselectable="on">
<select id="assignee" class="form-control required" style="padding: 0px; display: none;" name="assignedUserId" data-role="dropdownlist" title="">
<option value="28941">Option 1</option>
<option value="28938">Option 2</option>
<option value="28940">Option 3</option>
<option value="28942">Option 4</option>
<option value="28943" selected="selected">Option 5</option>
<option value="28939">Option 6</option>
</select>
</span>
</span>
I tried to select the option 3 on drop-down list, below is my code:
public Page selectAsignee(String asignee){
try{
WebElement dropdownAsignee = connector.waitForControl(SBConstant.XPATH,dropdownAssignee,3);
// My xPath is //select[@id='assignee']
Select select = new Select(dropdownAsignee);
select.selectByVisibleText("Option 3");
return this;
}catch (StaleElementReferenceException s){
s.toString();
}
return this;
}
But it's unable to select option 3 although web driver can detect the select with id ="assignee". After run this code, it throws the error like this:
org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with
I'm hoping someone can point out an error on my part that will make this all better.