from selenium import webdriver
from selenium.webdriver.common.by import By
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(ChromeDriverManager().install())
driver.get("https://www.youtube.com/?hl=zh-TW&gl=TW") # 更改網址以前往不同網頁
#driver.close() # 關閉瀏覽器視窗
element = driver.find_element_by_class_name("style-scope ytd-searchbox")
element.send_keys("阿滴英文")
#點擊搜尋
start_search_btn = driver.find_element_by_id("search-icon-legacy")
start_search_btn.click()
#點擊圖片
image = driver.find_element_by_id("img")
image.click()
movie = driver.find_element_by_link_text("10支最熱門的影片")
movie.click()
最後的程式碼無法觸擊