python – How do you fix the element not interactable exception?

python – How do you fix the element not interactable exception?

A possibility is that the element is currently unclickable because it is not visible. Reasons for this may be that another element is covering it up or it is not in view, i.e. it is outside the currently view-able area.

Try this

from selenium.webdriver.common.action_chains import ActionChains

button = driver.find_element_by_class_name(uinfoDismiss)
driver.implicitly_wait(10)
ActionChains(driver).move_to_element(button).click(button).perform()

I just ran into a similar issue and was able to fix it by waiting until the button was clickable.

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

chrome_options = webdriver.ChromeOptions()
chrome_options.add_experimental_option(useAutomationExtension, False)
browser = webdriver.Chrome(./chromedriver, options=chrome_options)

browser.get((YOURWEBSITEHERE.COM))

button = WebDriverWait(browser, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, button.dismiss)))
button.click()

python – How do you fix the element not interactable exception?

The error Message: element not interactable mostly occurs when your element is not clickable or it is not visible yet, and you should click or choose one other element before it. Then your element will get displayed and you can modify it.

You can check if your element is visible or not by calling is_displayed() method like this:

print(Element is visible?  + str(element_name.is_displayed()))

Leave a Reply

Your email address will not be published.