WatiN permissions issue when eval javascript code

My environment: WindowXP, IE8, VS2008, WatiN-2.0.20

When I try to execute the following code:

IE _browser = new IE();
_browser.GoTo(_url);
_browser.Eval("alert('hello!');");

I get the following error:

Message:

"Access denied. (Exception of HRESULT: 0x80070005 (E_ACCESSDENIED))"

Source:

"Microsoft.mshtml"

Partial StackTrace

   in WatiN.Core.Native.InternetExplorer.IEUtils.RunScript(String scriptCode, String language, IHTMLWindow2 window)
   in WatiN.Core.Native.InternetExplorer.IEDocument.RunScript(String scriptCode, String language)
   in WatiN.Core.Document.RunScript(String scriptCode, String language)
   in WatiN.Core.Document.RunScript(String javaScriptCode)
   in WatiN.Core.Document.Eval(String javaScriptCode)

I know about the problem with suggestions, but I don’t know how to solve it. Any ideas on this issue.

+5
source share
1 answer

Try disabling protected IE mode or adding your site to a trusted zone.

+10
source

All Articles