Python:Selenium 无法在弹出窗口中找到 btn

问题描述 投票:0回答:0

我正在尝试单击 cookie 条款弹出窗口中的按钮“选择所有 cookie”。 我试过:

div=driver.find_element(By.XPATH,'//*[@id="js_cookie-settings-modal"]/div[2]/div/div[3]/div')
driver.implicitly_wait(4)
button=div.find_element(By.XPATH,'//*[@id="selectAll"]')
driver.implicitly_wait(4)
button.click()

错误:

  raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
  (Session info: chrome=111.0.5563.64)

选项2:

WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH,'//*[@id="selectAll"]'))).click()
driver.implicitly_wait(50)

错误:

   raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message: 

网址:https://www.eversports.de/

python selenium-webdriver popup click
© www.soinside.com 2019 - 2024. All rights reserved.