📅  最后修改于: 2022-03-11 14:46:47.454000             🧑  作者: Mango
# credit to the Stack Overflow user in the source link
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.Chrome()
driver.get("put_your_URL_here")
# NOTE: actual name of the button is required so remember to change
# the name from "Accept" to the proper button name
WebDriverWait(self.driver, 10).until(EC.element_to_be_clickable((By.XPATH, "//button[text()='Accept']"))).click()