"ElementNotInteractableException" on trying to click elements inside of previously hidden div, selenium python "ElementNotInteractableException" on trying to click elements inside of previously hidden div, selenium python selenium selenium

"ElementNotInteractableException" on trying to click elements inside of previously hidden div, selenium python


I was having a similar problem.This button keeps hidden until something goes wrong on the form.So I faked a problem and I could find the button, visually and inside the page code.But when i tryed to click it, using the following code:

driver.find_element_by_class_name('btn_ok_alert').click()

I got the Element Not Interactable Exception...After sweeping the page code for a long time, I found out that were two buttons with the same name, and the first one was still hidden.

The solution i found was use the multiple elements search method that gives you a index for handle it:

elem = driver.find_elements_by_class_name('btn_ok_alert')elem[1].click()

This happens because the search of the driver begins at the top of the page and will find the button that still hidden (for another purpose) first.And if I meant to click the first one it would be like:

elem[0].click()