In python we have:

select = Select(driver.find_element_by_id('fruits01'))

But what if I want to have a list of all select tags and not just the first one?

I tried:

select = Select(driver.find_elements_by_id('fruits01'))

But it didn't work for me.

New contributor
Algo is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

2 Answers 2


As per the Selenium Python API Docs of Select():

class selenium.webdriver.support.select.Select(webelement)
    A check is made that the given element is, indeed, a SELECT tag. If it is not, then an UnexpectedTagNameException is thrown.

So Select() takes a webelement as an argument and you won't be able to pass webelements.

Moreover, each webelement is unique within the DOM Tree. So it's highly unlikely multiple elements would be identified using the same value of id attribute i.e. fruits01.

This usecase

However, considering the usecase as a valid usecase the simplest approach would be similar to @Arundeep Chohan's answer but ideally inducing WebDriverWait for the visibility_of_all_elements_located() as follows:

elements = WebDriverWait(driver, 20).until(EC.visibility_of_all_elements_located((By.ID, "fruits01")))
for element in elements:
    select = Select(element)

Note : You have to add the following imports :

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
for elem in elems:

Why not just use a list to loop them ? I don't think you can do it the way you want to.

Your Answer

Algo is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.