# Element Not Interactable Exception how to solved it

**URL:** <https://forum.robotframework.org/t/element-not-interactable-exception-how-to-solved-it/5058>\
**Category:** Robot Framework\
**Created:** [12 December 2022 10:51 UTC](https://forum.robotframework.org/t/element-not-interactable-exception-how-to-solved-it/5058 "2022-12-12T10:51:23Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![rahul12](https://avatars.discourse-cdn.com/v4/letter/r/e9c0ed/32.png) [@rahul12](https://forum.robotframework.org/u/rahul12)\
**Post date:** [12 December 2022 10:51 UTC](https://forum.robotframework.org/t/element-not-interactable-exception-how-to-solved-it/5058/1 "2022-12-12T10:51:23Z")

</div>

```
    [Arguments] ${card_name}
     Wait Until Element Is Visible ${loc} ${short_time}
     @{Locators_common} = Get WebElements ${loc_}
      Click Element ${Locators_common}[${card_name}]
     Wait Until Element Is Visible ${loc_Validation} ${short_time}

```

hi i am new at robot framework  
i want to used element from locator\_common list on the basic of their index so  
when i used click element and pass ${Locators\_common}[${card\_name}] that time ElementNotInteractableExceptionexcepation showd ho to deal it ?

---

<div class="post-metadata">

**Author:** ![\_daryl](https://avatars.discourse-cdn.com/v4/letter/_/45deac/32.png) [@\_daryl](https://forum.robotframework.org/u/_daryl)\
**Post date:** [12 December 2022 11:16 UTC](https://forum.robotframework.org/t/element-not-interactable-exception-how-to-solved-it/5058/2 "2022-12-12T11:16:19Z")

</div>

Hi @rahul12

Error your receiving is thrown to indicate that although an element is present on the HTML DOM, (which would suggest the locator looks to be valid) but it suggests it is not in a state that can be interacted with. And the “Wait Until Element Is Visible” is a good start and should normally resolve the issue in most, could you **confirm** if the element you’re wanting to ‘Click’ is out of view on load? as you may have to scroll this into view before interacting with it, this can be achieved with the below as something to try

**SeleniumLibrary:**  
`Scroll Element Into View ${Locators_common}[${card_name}]`

You could wrap that in [Run Keyword And Ignore Error] which is part of the built-in library, depending on your error handling

But in terms of fully understanding where the issue may be sharing the log for where it’s falling over and possibly a snippet of the dom for the element you’re trying to click, could be helpful in helping you if the above doesn’t resolve where the exception is thrown.

---

<div class="post-metadata">

**Author:** ![rahul12](https://avatars.discourse-cdn.com/v4/letter/r/e9c0ed/32.png) [@rahul12](https://forum.robotframework.org/u/rahul12)\
**Post date:** [12 December 2022 12:14 UTC](https://forum.robotframework.org/t/element-not-interactable-exception-how-to-solved-it/5058/3 "2022-12-12T12:14:12Z")

</div>

thanks  
but after used Scroll Element Into View ${Locators\_common}[${card\_name}]  
same exception will showed ElementNotInteractableException: Message: element not interactable:

---

<div class="post-metadata">

**Author:** ![\_daryl](https://avatars.discourse-cdn.com/v4/letter/_/45deac/32.png) [@\_daryl](https://forum.robotframework.org/u/_daryl)\
**Post date:** [12 December 2022 13:25 UTC](https://forum.robotframework.org/t/element-not-interactable-exception-how-to-solved-it/5058/4 "2022-12-12T13:25:39Z")

</div>

_→ Are you able to provide a snippet of the dom and RF logs for where it’s falling over, if it’s a public site then providing the Url and for which element you’re having trouble would be helpful as mentioned… ←_

But, I’m almost certain the problem is this below in bold as it will be by index you’ll need to use to return that item (element) from the list of elements, and then do some form of a check to make sure its the correct element you want to interact with, based on what’s been given:

@{Locators\_common} = Get WebElements ${loc\_}  
Click Element ${Locators\_common}**[${card\_name}]**

Hard not to guess when there’s not much given but it will be a 0-based index, and not knowing what “card\_name” holds, could be 0+ or a string value…

I guess there are a number of things you could do, if all cards use the same/part locator + ${card\_name} you can remove the line of `@{Locators_common} = Get WebElements ${loc_}` and then, set a common variable for ${cards\_common}, then do the below:

`Click Element ${cards_common}//*[@text='${card_name}']`

You’ll just need to figure out what that common part is, the dom is a good place to figure out what that common XPath may look like.

---

<div class="post-metadata">

**Author:** ![rahul12](https://avatars.discourse-cdn.com/v4/letter/r/e9c0ed/32.png) [@rahul12](https://forum.robotframework.org/u/rahul12)\
**Post date:** [13 December 2022 14:20 UTC](https://forum.robotframework.org/t/element-not-interactable-exception-how-to-solved-it/5058/5 "2022-12-13T14:20:15Z")

</div>

Thanks daryl

---

<div class="post-metadata">

**Author:** ![Raghuveer-i](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/raghuveer-i/32/3927_2.png) [@Raghuveer-i](https://forum.robotframework.org/u/Raghuveer-i)\
**Post date:** [2 June 2024 12:39 UTC](https://forum.robotframework.org/t/element-not-interactable-exception-how-to-solved-it/5058/7 "2024-06-02T12:39:37Z")

</div>

xpath = (//input[@id=‘signInFormUsername’])[2] it does not highlight the element

---

<div class="post-metadata">

**Author:** ![CharlieScene](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/charliescene/32/3484_2.png) [@CharlieScene](https://forum.robotframework.org/u/CharlieScene)\
**Post date:** [2 June 2024 13:41 UTC](https://forum.robotframework.org/t/element-not-interactable-exception-how-to-solved-it/5058/8 "2024-06-02T13:41:04Z")

</div>

Hi,

You might use the [1] element which is the one visible and interactable.  
The second one might be hidden and used/built for other purposes (other login type or frame not displayed currently)  
However you didn’t mentioned what fails ? I assume the ‘Input Text’ keyword ?

Verify in the upper levels of the xpath if the //input is not in an **iframe** or **shadow-dom**.  
In the iframe case you should select it first to “enter” the frame and interact with its content.  
Then don’t forget to Unselect Frame after to continue interaction after login.

For shadow-dom this would be more tricky depending of the used libraries.

Regards.  
Charlie

---

<div class="post-metadata">

**Author:** ![CharlieScene](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/charliescene/32/3484_2.png) [@CharlieScene](https://forum.robotframework.org/u/CharlieScene)\
**Post date:** [2 June 2024 14:07 UTC](https://forum.robotframework.org/t/element-not-interactable-exception-how-to-solved-it/5058/9 "2024-06-02T14:07:16Z")

</div>

Hi Again,

Well it’s none of the ideas above, I went to your page there’s no iframe nor shadow-dom.  
I have it working with your xpath the first time in debug, but not the second time…  
I don’t really now why but sometimes the needed and interactable input is the [1] and sometimes the [2], and seems to switch randomly.

Finally I think you’ll need the precise the xpath in a more accurate way… You might know better what’s important for you, but this works :

```
Login Test
    Open Browser https://i-fi.ai/login chrome
    Maximize Browser Window
    Input Text //div[contains(@class, 'visible-md visible-lg')]//input[@id='signInFormUsername'] TestingName

```

I only found a difference in the upper div with _visible-md visible-lg_ attribute, and oddly both input have a _hidden_ attribute.

Then if the attribute is not a strong solution enough, you could also use only one simple xpath in a try/except (even though it’s some kind of ugly workaround) :

```
TRY
    Input Text (//input[@id='signInFormUsername'])[1] TestingName1
EXCEPT
    Input Text (//input[@id='signInFormUsername'])[2] TestingName2
END

```

Regards.  
Charlie

---

<div class="post-metadata">

**Author:** ![Raghuveer-i](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/raghuveer-i/32/3927_2.png) [@Raghuveer-i](https://forum.robotframework.org/u/Raghuveer-i)\
**Post date:** [2 June 2024 14:38 UTC](https://forum.robotframework.org/t/element-not-interactable-exception-how-to-solved-it/5058/10 "2024-06-02T14:38:05Z")

</div>

Thanks a lot @CharlieScene . its working!!!
