I've lurked here for quite a while and gotten a lot of help from other questions but am having trouble finding a solution to the following. I am trying to select 225 from the following dropdown:
<pre><div class="controls controls-select"></pre>
<select name="duration" class="input-medium"><option value="" selected="selected"></option><option value="225">225 minutes</option></select><br>
<p class="help-block" id="reservations-checkout-date" style="display: none;"></p>
</div>
Using the following code:
duration = Select(browser.find_element_by_name('duration'))
duration.select_by_value('225')
However, I get this error.
Traceback (most recent call last):
File "C:/Users/bfarlow/AppData/Local/Programs/Python/Python37-32/pool.py", line 33, in <module>
duration = Select(browser.find_element_by_name('duration'))
File "C:\Users\bfarlow\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 496, in find_element_by_name
return self.find_element(by=By.NAME, value=name)
File "C:\Users\bfarlow\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 978, in find_element
'value': value})['value']
File "C:\Users\bfarlow\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\bfarlow\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[name="duration"]"}
(Session info: chrome=81.0.4044.138)
Thanks for taking a look and I apologize for any formatting errors.