Press button with Selenium in Python

Viewed 956

Path here

I need to press the button but cant really figure out how

I tried copying the xpath but get an error

also tried to press the button over the id or class_name but also not worked

If you have an idea please write it in the comments. Thanks

Tried so far:

driver.find_element_by_xpath("//button[@class='action-button']").click()
driver.find_element_by_class_name("action-button").click()
driver.find_element_by_xpath("[@id='clearBrowsingDataConfirm']").click()
driver.find_element_by_id('[@id="clearBrowsingDataConfirm"]').click()
1 Answers

Should work if it's not in a iframe.

driver.find_element_by_id('clearBrowsingDataConfirm').click()

Try this if it's after driver.get()

WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.ID, 'clearBrowsingDataConfirm'))).click()

Import

from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait 
from selenium.webdriver.support import expected_conditions as EC
Related