Selenium is about finding the elements to do action upon, the dropdown box exercise can be found here. From the web developer tool of your selected browser find the element of option1 and option2 and copy their xpaths, xpath is the most accurate for selenium to act upon, my preference is always xpath then next is css_selector if xpath for some reason does not work.
Below is the code for this exercise.
from selenium import webdriver import os from time import sleep from random import uniform def find_file(base="C:\\", name=None): """ Find file and return the first match found. :param base: Base path to search :param name: filename to search :return: absolute path of the file. """ for root, dirs, filename in os.walk(base): if name in filename: return os.path.join(root, name) driver = webdriver.Firefox(executable_path=find_file(name="geckodriver.exe")) driver.get("https://the-internet.herokuapp.com/dropdown") # Select option1. driver.find_element_by_xpath('/html/body/div/div/div/select/option').click() # use sleep to temporarily pause before next click. sleep(uniform(5, 10)) # select option2. driver.find_element_by_xpath('/html/body/div/div/div/select/option').click()