加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

selenium – 在TeamCity代理的Windows服务下运行时构建时,Micros

发布时间:2020-12-14 05:34:01 所属栏目:Windows 来源:网络整理
导读:使用: * Windows 10专业版 * MicrosoftWebDriver版本14393 我在使用Edge运行我的UI测试套件时遇到了麻烦(而Chrome,Firefox和IE11都可以运行).在标准的Windows开发环境中运行时不会出现此问题.只有在尝试在CI(TeamCity)代理上运行这些UI测试时才会出现此问题
使用:
* Windows 10专业版
* MicrosoftWebDriver版本14393

我在使用Edge运行我的UI测试套件时遇到了麻烦(而Chrome,Firefox和IE11都可以运行).在标准的Windows开发环境中运行时不会出现此问题.只有在尝试在CI(TeamCity)代理上运行这些UI测试时才会出现此问题.代理程序配置为作为Windows服务运行.

首先,当运行代理服务的帐户被授予管理员帐户时,我收到了:

“Microsoft Web Driver can’t be used with the Built-In Administrator
account or while User Account Control is turned off.”

错误和浏览器甚至没有开始.经过一段时间的谷歌搜索,我什么都没有放弃.所以我删除了管理员的权限并且消息已经消失,但是驱动程序在构建阶段仍然失败:

Fatal Error
[10:57:37][Step 1/1] OpenQA.Selenium.WebDriverException: Unexpected error. Unknown error
[10:57:37][Step 1/1] w OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
[10:57:37][Step 1/1] w OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute,Dictionary`2 parameters)
[10:57:37][Step 1/1] w OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
[10:57:37][Step 1/1] w OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor,ICapabilities desiredCapabilities)
[10:57:37][Step 1/1] w OpenQA.Selenium.Edge.EdgeDriver..ctor(EdgeDriverService service,EdgeOptions options)
[10:57:37][Step 1/1] w Learn.UITests.Common.Infrastructure.Selenium.Setup.DriverFactory.CreateDriver(UITestsContext context) w DriverFactory.cs:wiersz 60
[10:57:37][Step 1/1] w Learn.UITests.Common.Infrastructure.Selenium.ContextBase.OnAssemblyStart() w my_code 24

我实例化边缘驱动程序的方式只是默认值:

var ie11Driver = new InternetExplorerDriver(InternetExplorerDriverService.CreateDefaultService(driverPath));

有人能指出我能做些什么才能看到我的边缘UI测试在后台Windows服务下运行(与IE11,Chrome和Firefox相同)?

解决方法

“Microsoft Web Driver can’t be used with the Built-In Administrator account or while User Account Control is turned off.”

这在Windows 10 Pro N上为我解决了这个问题.
有关所有Windows版本的完整说明,请查看this link

>按住Windows键并按R键
>在运行对话框中,键入secpol.msc并按Enter键(打开本地安全策略)
>在左侧窗格中,导航到安全设置>本地政策>安全选项
>在右窗格中找到内置管理员帐户的用户帐户控制管理员批准模式.双击它以打开其属性
>在Local Security Setting选项卡中选择Enabled,然后单击Ok
>现在重新启动计算机并检查它是否正常工作

enter image description here

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读