Skip to content Skip to sidebar Skip to footer

Selenium Click On Accept The Risk And Continue

I have loaded the following drive.page_source using selenium:

Solution 1:

Try waiting for the element.

WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH,'//button[@id="exceptionDialogButton"]'))).click()

Import

from selenium.webdriver.common.byimportByfrom selenium.webdriver.support.uiimportWebDriverWaitfrom selenium.webdriver.supportimport expected_conditions asEC

Solution 2:

You should not look for a harder ways if there is already element ID. Try this:

from selenium.webdriver.support.wait importWebDriverWaitwait= WebDriverWait(driver, 10)
wait.until(EC.element_to_be_clickable((SelectBy.ID, "exceptionDialogButton")))
driver.driver.find_element_by_id("exceptionDialogButton").click()

Try also exception_button as a locator. Also try css selector: button[data-telemetry-id=exception_button]

It will look like this:

from selenium.webdriver.support.wait importWebDriverWaitwait= WebDriverWait(driver, 10)
wait.until(EC.element_to_be_clickable((SelectBy.CSS_SELECTOR, "button[data-telemetry-id=exception_button]")))
driver.driver.find_elements_by_css_selector("button[data-telemetry-id=exception_button]").click()

Post a Comment for "Selenium Click On Accept The Risk And Continue"