Im really struggling with selecting an item from a drop down menu on a site I'm trying to scrape. The code for the HTML is shown below:
<select id="averagesMP" name="MP" onchange="reQuery(this);" style="width: 150px">
<option value="" selected="selected"></option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
I've tried everything I can think of and find on StackOverflow! I've noticed that this seems to work to select the actual drop down box:
select_mp = Select(driver.find_element_by_xpath("//select[@name='MP']"))
but I only assume that works because the code runs and doesn't give any errors. However, I still can't select anything from the dropdown menu. I've tried:
- find_element_by_xpath/name/id/tag/value/text
- select_mp.select_by_value('2')
- select_mp.select_by_visible_text('2')
- select_mp.select_by_index(2)
- driver.find_element_by_xpath("//select[@name='MP']/option[@value='4']").click()
- driver.find_element_by_xpath("//option[@value='4']").click()
- driver.find_element_by_id('averagesMP').click()
Does anyone have any advice? I know that this question seems to get asked alot on here, but I've tried everything I've seen in a post and its not working! It doesn't seem like a very complicated dropdown menu, only very elusive.
Some helpful info:
I'm using Safari and SafariDriver
I keep getting an error message of:
raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: