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 =
JavaScript
x
3
1
driver.find_element_by_xpath("//span[@class='example']")
2
<selenium.webdriver.remote.webelement.WebElement (session="9e25c2b4350ca89b8da611a6dc63ae0c", element="f8dc7d1a-a31a-4fc8-98ec-34ff5a7fa12e")>
3
this message error:
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
Advertisement
Answer
Use WebDriverWait
() and wait for element_to_be_clickable
()
JavaScript
1
2
1
WebDriverWait(driver,20).until(EC.element_to_be_clickable((By.XPATH,"//span[@class='example']"))).click()
2
you need to import below libraries
JavaScript
1
4
1
from selenium.webdriver.support.ui import WebDriverWait
2
from selenium.webdriver.support import expected_conditions as EC
3
from selenium.webdriver.common.by import By
4