Undescriptive error when doing ExecuteScript in IE11

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
Posts: 10
Joined: Wed Jan 14, 2015 1:20 pm

Undescriptive error when doing ExecuteScript in IE11

Post by bellew.mike » Fri Apr 17, 2015 2:40 pm

Ranorex Version:
IE: 11


I have just spend 2 days trying to solve this issue.
So thought I would share the knowledge here and hopefully Ranorex will implement a better error message for this situation. (Or just make it work and not throw an exception)

Command attempted: (Any js command was throwing an error. Not just localstorage)

Code: Select all


Code: Select all

Action 'executescript' failed on element '{WebDocument:Google}'
   at Ranorex.Core.Element.InvokeAction(String name, Object[] args)
   at Ranorex.WebDocument.ExecuteScript(String code)

Code: Select all

Specified cast is not valid.
   at mshtml.IHTMLDocument2.get_parentWindow()
   at Ranorex.Plugin.WebFlavor.ExecuteUserScript(String code, IHTMLDocument2 rootDoc)
   at Ranorex.Plugin.WebDocumentFlavorElement.InvokeAction(Element element, String name, Object[] args)
   at Ranorex.Core.Element.InvokeAction(String name, Object[] args)
This error was only occurring on the VMs we were running the tests on, and not my local debug machine so I spent a great deal of time trying to find out what was wrong.

To cut a long story short the issue turned out to be that the Ranorex IE Plugin had become disabled on my VMs. Everything in the tests appeared to work correctly so this did not even occur to me but this is my conclusion:
If the IE ranorex plugin is disabled. ExecuteScript() throws this (fairly useless) exception.
Hope this helps someone if they run accross the same issue.


User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA

Re: Undescriptive error when doing ExecuteScript in IE11

Post by Support Team » Thu Jan 14, 2016 1:20 pm

Hello bellew.mike,

It seems like the issue doesn't occur anymore. Please update to Ranorex 5.4.4.

Hope this information helps.