Strange drop down automation problem - multiple select
I've tried for days to figure this one out. I have a selector that I can't figure out. It seems to be a regular select statement with multiple options but when clicking one option directly it changes the title on a button. I can't figure out how to manipulate it. All I want to do is find a specific selection option and select it. I don't need to select multiple options.
The code I'm seeing is as follows:
<select multiple="" id="assignTo" data-placeholder="Select Instructor(s)" title="Instructor(S)" name="instructors" class="form-control bootstrapmultiselect" style="display: none;"> <option value="864979">Joe Smith</option> <option value="355944">Mary Jones</option> <option value="44177">Bill Smith</option> <option value="551573">Susan Carter</option> <option value="883308">Brian Bird</option> </select> <div class="btn-group" style="width: 100%;"> <button type="button" class="multiselect dropdown-toggle btn btn-default" data-toggle="dropdown" title="None selected" style="width: 100%;">None selected <strong class="caret"></strong></button>
Here's the code I've tried:
drop = select(driver.find_element_by_id('assignTo')) instructor_option = WebDriverWait(driver,5).until(lambda x: x.find_element_by_xpath("//select[@id='assignTo']/option[text()='Bill Smith']")) instructor_option.select()
Any ideas? I appreciate any help at all!
inna last edited by
There is nothing wrong with your
selectlocator. I assume the thing that changes are underlying values of available options, try selecting by visible text:
I have used
javasyntax, here is python: