【发布时间】:2023-04-11 01:03:01
【问题描述】:
我正在使用 Watin 2.1.0 运行自动 IE 浏览器测试。它们在我的本地机器上正常工作,但是我试图让它们在我的 TeamCity 构建机器上运行,但是当测试在每个测试的同一特定点运行时出现此错误:
System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
完整的堆栈跟踪:
at mshtml.HTMLWindow2Class.IHTMLWindow2_execScript(String code, String language)
at WatiN.Core.Native.InternetExplorer.IEUtils.RunScript(String scriptCode, String language, IHTMLWindow2 window)
at WatiN.Core.Native.InternetExplorer.IEUtils.RunScript(String scriptCode, String language, IHTMLWindow2 window)
at WatiN.Core.Native.InternetExplorer.IEElement.GetJavaScriptElementReference()
at WatiN.Core.Native.InternetExplorer.IEFireEventHandler.CreateJavaScriptFireEventCode(NameValueCollection eventObjectProperties, String eventName)
at WatiN.Core.Native.InternetExplorer.IEFireEventHandler.FireEvent(String eventName, NameValueCollection eventProperties, Boolean noWait)
at WatiN.Core.Native.InternetExplorer.IEElement.FireEvent(String eventName, NameValueCollection eventProperties)
at WatiN.Core.Element.FireEvent(String eventName, Boolean waitForComplete, NameValueCollection eventProperties)
at WatiN.Core.Element.FireEvent(String eventName)
at WatiN.Core.Element.Focus()
我不确定这里发生了什么。运行测试的用户帐户是管理员,我已在 IE 设置中将站点设置为受信任站点。我很确定它在 TeamCity 中的设置是我错过的,因为它们在本地工作,但不在 TeamCity 构建服务器上。
任何帮助将不胜感激。
编辑: 我们有三个 Team City 代理运行多个项目,其中一个作为主机 这是不是主机的构建代理之一的“登录”选项卡:
勾选了“允许服务与桌面交互”复选框,但 Watins 仍然不起作用。
在主机上:
但是,Watins 也不能在这台机器上工作。 Watins 还使用不同的用户帐户将 IE 作为进程运行。因此,构建代理在用户帐户“A”下运行,并且作为 watin 测试的一部分,IE 在用户帐户“B”下运行。
此信息可能与寻找解决方案更相关。谢谢!
【问题讨论】:
标签: c# internet-explorer teamcity watin