The element is present inside an iframe
you need to switch the iframe
in order to access the element.
Induce WebDriverWait
() and wait for frame_to_be_available_and_switch_to_it
() and following css selector
Induce WebDriverWait
() and wait for element_to_be_clickable
() and following xpath
driver.get("http://www.legorafi.fr/")
WebDriverWait(driver,10).until(EC.frame_to_be_available_and_switch_to_it((By.CSS_SELECTOR,"#appconsent>iframe")))
WebDriverWait(driver,10).until(EC.element_to_be_clickable((By.XPATH,"//span[text()='Tout Accepter']"))).click()
You need to import below libraries
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC