How do you fix the "element not interactable" exception? How do you fix the "element not interactable" exception? selenium selenium

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 ActionChainsbutton = driver.find_element_by_class_name(u"infoDismiss")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 webdriverfrom selenium.webdriver.common.by import Byfrom selenium.webdriver.support.ui import WebDriverWaitfrom selenium.webdriver.support import expected_conditions as ECchrome_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()


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()))