Forums

Selecting from dropdown list using Selenium Select.

I’m unable to select from a dropdown list, receiving the following error:

selenium.log:selenium.common.exceptions.UnexpectedTagNameException: Message: Select only works on <select> elements, not on <input>

I’ve tried the following:

DateField=Select(browser.find_element_by_id("ctl00_Main_TVL_ctl00_Nav_ctl00_Dates_Input"))

Things work well until I attempt to access the dropdown list as I access the page and successfully log in.

What am I doing wrong with the element? What is the <select> element?

That sounds like the element that you are accessing is not a select element, but an input. It's possible that the page swaps out the input for a select (or something else) at some action (like maybe clicking the input). You would have to use the debug tools in your browser to work out what is going on with the page so you can work out how to automate it.