Apr-23-2025, 12:26 PM
I am facing the select option issue. If anyone have solution please help. Thanks
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
from selenium import webdriver from selenium.webdriver.chrome.service import Service from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import Select from bs4 import BeautifulSoup import time service = Service(executable_path = r '/usr/bin/chromedriver' ) options = webdriver.ChromeOptions() #options.add_argument('--headless') options.add_argument( "--disable-notifications" ) options.add_argument( '--no-sandbox' ) options.add_argument( '--disable-dev-shm-usage' ) driver = webdriver.Chrome(service = service, options = options) print (driver.page_source) inputElement = driver.find_element(By. ID , 'link' ) inputElement.send_keys(Keys.ENTER) time.sleep( 20 ) print (driver.page_source) soup = BeautifulSoup(driver.page_source, 'html.parser' ) drop_down_node = driver.find_element(By. ID , 'render_video' ) drop = Select(drop_down_node) drop.select_by_index( 1 ) time.sleep( 10 ) input ( "press any key to continue..." ) driver.quit() |