How to select a drop-down menu value with Selenium using Python?

Selenium provides a convenient Select class to work with select -> option constructs:

from selenium import webdriver
from import Select

driver = webdriver.Firefox()

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

# select by visible text

# select by value 

See also:

  • What is the correct way to select an using Selenium’s Python WebDriver?

Leave a Comment