eval javascript 代码时出现 WatiN 权限问题

发布于 2024-09-28 07:18:58 字数 844 浏览 1 评论 0原文

我的环境是:WindowXP、IE8、VS2008、WatiN-2.0.20

当我尝试执行以下代码时:

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

我收到以下错误:

消息:

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

来源:

"Microsoft.mshtml"

部分 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)

我知道是关于权限问题,但我不知道如何解决它。 关于这个问题的任何想法。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

被你宠の有点坏 2024-10-05 07:18:58

尝试关闭 IE 的保护模式或将您的网站添加到受信任区域。

Try turning off IE's protected mode or add your site to trusted zone.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文