I need to select an element from a drop-down menu.
The dropdown menu has two value and I need to select the second "sponsor.com"
<select tabindex="1" name="userDomain" onchange="javascript:doWFAction('ReloadUser');">
<optgroup label="Selected">
<option value="0" selected=""></option>
</optgroup>
<optgroup label="Other">
<option value="261">sponsor.com</option>
</optgroup>
</select>
What I have tried but doesnt work (I am a beginner, actually my first project)
driver.find_element_by_xpath("//select/option[@value='261']").click()
driver.find_element_by_xpath("//select[@name='userDomain']/option[text()='Other']").click()
select = Select(driver.find_element_by_name('userDomain'))
select.select_by_visible_text('Other')
select.select_by_value('261').click()
if I do this command
driver.find_element_by_name('userDomain').click()
I can click on the drop-down menu but don't know how to select sponsor.com