My environment is: WindowXP, IE8, VS2008, WatiN-2.0.20
When i try to execute the follow 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 is about a premissions problem but i don't know how solve it. Any ideas about this issue.
Try turning off IE's protected mode or add your site to trusted zone.
来源:https://stackoverflow.com/questions/3986477/watin-permissions-problem-when-eval-javascript-code