Selenium Select not working on dropdown element


So I am trying to run the following code to select an option from a drop-down toolbar:

## Drop-down menu
time.sleep(5) # wait for element to load in page otherwise selenium won't be able to find it
element_dropdown = driver.find_element("id","conference-dropdowns")

# Select visible text
select = Select(element_dropdown)
select.select_by_visible_text("Bulk Upload")

But then I get the following error:

UnexpectedTagNameException: Message: Select only works on <select> elements, not on <label>

How do I resolve this issue? Why am I getting this error? See structure below. Thanks so much in advance.
enter image description here


The desired element isn’t within any tag, but they are within <label> tag.

Bulk Upload

So you won’t be able to use Select() class.


The click element with text as Bulk Upload you need to induce WebDriverWait for the element_to_be_clickable() and you can use the following locator strategy:

  • Using XPATH:

    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//li[@class='dropdown-submenu']//label[@class='submenu' and contains(., 'Bulk Upload')]"))).click()
  • Note: You have to add the following imports :

    from import WebDriverWait
    from import By
    from import expected_conditions as EC

Answered By – undetected Selenium

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published