I am having no luck selecting an option from a <select>
using selenium. I have referenced https://sqa.stackexchange.com/questions/1355/what-is-the-correct-way-to-select-an-option-using-seleniums-python-webdriver
The html code is as follows:
<select name="Dropdownlistrequests" onchange="javascript:setTimeout('__doPostBack(\'Dropdownlistrequests\',\'\')', 0)" id="Dropdownlistrequests" style="height:51px;width:174px;Z-INDEX: 104; LEFT: 280px; POSITION: absolute; TOP: 72px">
<option selected="selected" value="1">Previous Days</option>
<option value="2">Previous Month</option>
<option value="3">Last 12 Hours</option>
<option value="4">Demand Poll</option>
<option value="6">Custom</option>
</select>
I have tried
requests = driver.find_element_by_id("Dropdownlistrequests")
requests.click()
for option in requests.find_elements_by_tag_name('option'):
if option.text == "Custom":
option.click()
break
And
requests = Select(driver.find_element_by_id("Dropdownlistrequests"))
requests.select_by_value("6")
And
b.find_element_by_xpath("//select[@id='Dropdownlistrequests']/option[text()='Custom']").click()
Instead of selecting the appropriate option the browser does nothing and moves on to the next bit of code. Could it have something to do the the javascript that is triggered by the onchange?
To provide some more context: I am running windows 7 enterprise and using selenium with marionette and Firefox developer edition 49.0a2
Update: This only sems to happen when usoing Marionette in python. I tried this same code in Java with and without Marionette and it worked