ExecuteScript() throws 'Accesss is deniend' exception
Posted: Tue Jan 06, 2015 1:45 pm
Hi,
I am using Ranorex V5.2.1 for our automated testing. I have some methods that are executing some javascript code using the Ranorex method ExecuteScript(). Everything works fine when I'm running the tests (including the execute javascript methods) on my local machine on IE, but I get 'UnauthorizedAccessException: Access is denied' error thrown for the execute javascript methods when tests are running in IE on a VM.
Here is the entire error message:
Here is a code sample to see how ExecuteScript() method is being used
Details about the machines were the ExecuteScript() method works without throwing exceptions: Windows 7 SP1 64bits, IE10 and IE11.
I hope you could give some information where the problem could be.
Thank you,
Elena
I am using Ranorex V5.2.1 for our automated testing. I have some methods that are executing some javascript code using the Ranorex method ExecuteScript(). Everything works fine when I'm running the tests (including the execute javascript methods) on my local machine on IE, but I get 'UnauthorizedAccessException: Access is denied' error thrown for the execute javascript methods when tests are running in IE on a VM.
Here is the entire error message:
VM details: Windows 7 SP1 64bits, IE11Ranorex.ActionFailedException: Action 'executescript' failed on element '{WebDocument:<webpage-title>}'. ---> System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
at mshtml.IHTMLWindow2.execScript(String code, String language)
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)
--- End of inner exception stack trace ---
at Ranorex.Core.Element.InvokeAction(String name, Object[] args)
at Ranorex.WebDocument.ExecuteScript(String code)
Here is a code sample to see how ExecuteScript() method is being used
Code: Select all
String javascriptCode = "return jQuery(':animated').length";
String active = dom.ExecuteScript(javascriptCode);
int activeCount = int.Parse(active);
if (activeCount == 0)
{
//some message being saved
return;
}
I hope you could give some information where the problem could be.
Thank you,
Elena