Skip to content
Advertisement

Powershell with Selenium: Error: element not interactable

I need to update a textarea with a value. The code below throws an error “element not interactable”. This is because the textarea has “display:none”. If I remove the word NONE manually and then run the script again, it works great and is able to set the value of the textarea.

JavaScript

So the only option available is to use Javascript so that I can interact with the DOM directly (https://fijiaaron.wordpress.com/2018/01/29/how-to-access-elements-when-you-get-elementnotinteractableexception/). So I would have to do something like this:

JavaScript

But now I get a different set of errors: javascript error: Invalid or unexpected token

Advertisement

Answer

Try to edit your code as below to execute js with variable:

JavaScript

As same as first line, you should extract the variable and replace to arguments[0]

JavaScript

You can execute JS like this, use arguments to pass your variables into JavaScript:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement