'fix the "element not interactable" exception?
I am trying to fix the following error from selenium, but right now I am not able to proceed.
selenium.common.exceptions.ElementNotInteractableException: Message:
I went into selenium documentation and previous stack overflow answers and I added to my code the WebDriverWait and element_to_be_clickable commands to try to overcome the problem. Right now the code is as follows:
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support.expected_conditions import element_to_be_clickable
options = webdriver.ChromeOptions()
options.add_argument("start-maximized");
options.add_argument("disable-infobars")
options.add_argument("--disable-extensions")
chrome_driver_path = 'my_chrome_path' # removed for security reasons
s = Service(chrome_driver_path)
browser = webdriver.Chrome(service = s)
browser.get('https://it.bidoo.com/')
browser.maximize_window()
LoginPath = '//div[@class="pull-right login login_mobile"]/a[@id="login_btn"]'
Loginbutton = browser.find_element(By.XPATH, LoginPath)
button = WebDriverWait(browser,20).until(element_to_be_clickable(Loginbutton))
button.click()
And I get the error selenium.common.exceptions.TimeoutException: Message:. My ultimate aim would be to click on the element which has a red circle around in the top right corner of the screenshot attached to this question. I am a newbie to selenium and if someone would be able to help me I would be very grateful.
Solution 1:[1]
I'm investigating about the ElementNotInteractableException error, I think its some sort of rendering inherent thing since the button click works after I enter in the browser inspection tool. Meanwhile you can use this working solution, which click a second login button
url = 'https://it.bidoo.com/'
driver.get(url)
buttons_list = driver.find_elements(By.CSS_SELECTOR, "#login_btn")
buttons_list[1].click()
p.s. I don't know if it was intended, but the options you defined in your code are not used in the browser, to use them you have to write browser = webdriver.Chrome(service = s, options = options)
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 | sound wave |

