I am trying to list the possible options in this Select element.
<select id="sl_coursePage" onchange="document.frm.submit();" name="sl_coursePage">
<option selected="selected" value="0"></option>
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
<option value="4"></option>
<option value="5"></option>
<option value="6"></option>
<option value="7"></option>
<option value="8"></option>
<option value="9"></option>
<option value="10"></option>
</select>
I can find the element itself fine with elem = driver.get_element_by_name('sl_coursePage'), but then when I tried to list the options by using elem.get_elements_by_xpath('.//*') or elem.get_elements_by_tag_name('option'), it gives me empty lists.
So then I tried to use Select from selenium.webdriver.support.ui and get the list by the following code:
elem = driver.get_element_by_name('sl_coursePage')
select = Select(elem)
list = select.options
However, when I try this, it raises this error:
selenium.common.exceptions.UnexpectedTagNameException: Message: Select only works on <select> elements, not on <input>
I don't understand how this is not a Select element when its tags say "select". If anyone can get any of these methods to work or present a functioning alternative method, I would be extremely grateful. Thanks in advance.