'Button click using Selenium not actionable
I am trying to fill in a registration form and click submit. But Selenium says the Registration button is not actionable. I have tried using actionchains and a couple of other techniques but generally get the same error.
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
My code...
driver.get('https://discover.workato.com/automate-2022/p/1?utm_source=Automate+2022&utm_medium=employee+referral&utm_campaign=MCoblentz')
time.sleep(3)
first_name = driver.find_element_by_xpath('//*[@id="FirstName"]')
first_name.send_keys(line[1])
skipping a few more fields to the button click (and neither the by class name or the xpath work)...
Button = driver.find_element(By.class name("mktoButtonWrap"))
# Button = driver.find_element_by_xpath('//*[@id="mktoForm_3468"]/div[17]/span')
Button.click()
For the life of me, I can't figure out:
Why the button is not actionable and what I need to do to click it. (Major problem)
Why Python won't run with the following find_element line (minor annoyance)
Button = driver.find_element(By.xpath('//*[@id="mktoForm_3468"]/div[17]/span')
Python is throwing an error that
'AttributeError: type object 'By' has no attribute 'xpath'
But I'm initializing with:
from selenium.webdriver.common.by import By
Solution 1:[1]
Your syntax is incorrect. It should be:
Button = driver.find_element(By.XPATH, '//*[@id="mktoForm_3468"]/div[17]/span')
If you import By correctly (from selenium.webdriver.common.by import By), your IDE should autocorrect and show correct options:

Solution 2:[2]
You need to consider a couple of things here as follows:
Instead of:
Button = driver.find_element(By.class name("mktoButtonWrap"))It should have been:
Button = driver.find_element(By.CLASS_NAME, "mktoButtonWrap")Similarly,
Button = driver.find_element(By.XPATH, '//*[@id="mktoForm_3468"]/div[17]/span')Further, this error message...
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactableindicates that the desired element is not interactable.
Solution
To click on Register you need to induce WebDriverWait for the element_to_be_clickable() and you can use either of the following locator strategies:
Using XPATH:
driver.get("https://discover.workato.com/automate-2022/p/1?utm_source=Automate+2022&utm_medium=employee+referral&utm_campaign=MCoblentz") driver.execute_script("arguments[0].click();", WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//button[@class='mktoButton' and text()='Register']"))))Note: You have to add the following imports :
from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | BillyZee |
| Solution 2 |
