Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from selenium import webdriver
- from selenium.webdriver.common.by import By
- from selenium.webdriver.support.ui import Select
- import time
- driver = webdriver.Chrome()
- driver.maximize_window()
- driver.get("https://omayo.blogspot.com/")
- # For dropdown
- dropdown = driver.find_element(By.ID, "drop1")
- # Creating Select object
- select = Select(dropdown)
- # Selecting an option by visible text
- select.select_by_index(2) # Change "Option 2" to the desired option text
- print("Changed value to index 2")
- time.sleep(20) # Giving a brief pause to see the changes (not required, but good for demonstration)
- driver.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement