c# - TeamCity 和 Selenium WebDriver

标签 c# selenium-webdriver nunit teamcity

我有一个 NUnit 测试项目,其中有一个简单的测试方法,该方法使用 WebDriver 查找页面上的元素。

我可以在VS2015中运行测试方法,没有问题。然后我尝试使用如下构建步骤在 TeamCity (9.1.6) 中构建此项目:

Runner type: NUnit
NUnit runner: NUnit 3
Path to NUnit console runner: packages\NUnit.ConsoleRunner.3.2.0\tools\nunit3-console.exe

当 TeamCity 尝试执行构建步骤时,我收到以下错误:

[Web.Test.FindPage] OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL http://localhost:64963/session/27d5b5b821e3b90c9d6f8183f05a3d05/element timed out after 60 seconds.
  ----> System.Net.WebException : The operation has timed out

TeamCity Server 和 Agent 均配置为在服务帐户下运行的 Windows 服务。

我有什么遗漏的吗?

最佳答案

事实证明,我无法将构建代理作为 Windows 服务运行。我必须在控制台中运行它。一旦我这样做了,问题就解决了。

关于c# - TeamCity 和 Selenium WebDriver,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36462350/

相关文章:

python - 如果元素不存在,selenium 中的条件语句

python - 即使 x 路径正确,Selenium Python 脚本也不会抛出任何元素错误异常?

c# - 如何记录 NUnit 测试错误或失败消息?

c# - XSLT 转换期间 XSD 上的 XML 验证

c# - SignalR,如何验证连接 ID 是否仍处于事件状态?

c# - 统一注册表单验证

selenium - 如何使用 Selenium 从选择下拉列表中检索选项的值?

c# - 在 TestCaseSource 中访问 NUnit 测试名称

c# - 如何使用 Moq 和 Autofixture 模拟 Entity Framework 6

c# - 在 ASP.NET C# 和 Razor 变量中编写 HTML 代码