WatiN permissions problem when eval javascript code

谁说胖子不能爱 提交于 2019-12-19 08:13:12

问题


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.


回答1:


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!