How can I click? Obviously with the mouse I can, and a new mask appears. While with the click () the following error appears.
Obviously the Xpath is correct in fact it reports the following code =
driver.find_element_by_xpath("//span[@class='example']") <selenium.webdriver.remote.webelement.WebElement (session="9e25c2b4350ca89b8da611a6dc63ae0c", element="f8dc7d1a-a31a-4fc8-98ec-34ff5a7fa12e")>
this message error:
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
Advertisement
Answer
Use WebDriverWait
() and wait for element_to_be_clickable
()
WebDriverWait(driver,20).until(EC.element_to_be_clickable((By.XPATH,"//span[@class='example']"))).click()
you need to import below libraries
from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By