Element Not Interactable Exception in selenium web action

Modified on Tue, 28 Mar, 2023 at 4:15 PM

Error Name: ElementNotInteractableException


Description: The "ElementNotInteractableException" error occurs when an element is found on the page, but it cannot be interacted with, either because it is not visible, disabled, or not clickable. This error can happen when automating web applications using Selenium or other similar tools.



Causes:


Cause 1: Element is not visible: The element being targeted is not currently visible on the page, such as when it is hidden behind another element or when it is outside the viewable area of the browser window.


Cause 2: Element is disabled: The element is present on the page but is disabled, meaning it cannot be interacted with until it is enabled by some action on the page.


Cause 3: Element is not clickable: The element is present on the page and visible, but it cannot be clicked because it is not configured to respond to mouse clicks, such as when it has an "onclick" attribute that is not properly defined.


Checks:


  1. Verify the element is interactable: Verify that the element is interactable, i.e., it can be clicked, typed into, or interacted with using the desired action. If the element is not interactable, the "ElementNotInteractableException" error will occur. In such cases, users may need to wait for the element to become interactable, adjust the timing of their script, or change the action being performed on the element.


  1. Verify the visibility of the element: Verify that the element is visible on the page and not hidden or obscured by another element. If the element is not visible, the "ElementNotInteractableException" error will occur. In such cases, users may need to adjust the visibility of the element or the page layout to ensure that the element is visible.





Debugs:

Debug 1: Verify that the element is not disabled: Check to make sure that the element being targeted is enabled and can be interacted with. If it is disabled, you may need to perform an action on the page to enable the element before attempting to interact with it.


Debug 2: Verify that the element is clickable: Check to make sure that the element being targeted can be clicked using the appropriate method (such as "click()" or "sendKeys()"). If the element cannot be clicked, you may need to modify your code to interact with it using a different method or attribute.


Debug 3: Use explicit waits: Use explicit waits to wait for the element to become visible, clickable, or enabled before attempting to interact with it.


Debug 4: Use alternative element locators: If the element cannot be located using its current locator strategy, try using a different strategy to locate it, such as XPath instead of CSS selectors.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article