selenium - 将 Selenium 测试与 tfs 集成

标签 selenium tfs nunit selenium-chromedriver agent

因此,我已将我的 NUnit Seleniumt 测试放入我们团队的 tfs 中。我已将它们配置为作为 Visual Studio 测试进行构建和运行。我已将 VsoAgent 配置为交互式。我的测试开始运行,但打开 Chrome 后,我看到一条消息,表明 Chrome 自动化扩展已停止工作,并且出现错误:

OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL http://localhost:54836/session timed out after 60 seconds.
----> System.Net.WebException : The operation has timed out
TearDown : System.NullReferenceException : Object reference not set to an instance of an object.
Stack Trace:
at OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest request)
at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute)
at OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute(Command commandToExecute)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeOptions options)
at SeleniumBase.Selenium_base.setUp(Browsers browser, String URL, Int32 waitMillis) in C:\TFS\agent3\_work\1\s\PentaJPKSelenium\Selenium_base.cs:line 38
at PentaJPKBase.PentaJPK_base.SetupTest() in C:\TFS\agent3\_work\1\s\PentaJPKSelenium\PentaJPKSelenium_base.cs:line 17
--WebException
at System.Net.HttpWebRequest.GetResponse()
at OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest request)
--TearDown
at PentaJPKBase.PentaJPK_base.TeardownTest() in C:\TFS\agent3\_work\1\s\PentaJPKSelenium\PentaJPKSelenium_base.cs:line 54Error: Exception NUnit.Core.UnsupportedFrameworkException, Exception thrown executing tests in C:\TFS\agent3\_work\1\s\PentaJPKSelenium\bin\Debug\PentaJPKSelenium.dll

当我在本地运行它们而不是通过代理时,一切正常。 有谁知道如何解决这个问题吗?

最佳答案

经过几个小时的寻找,我找到了解决方案。我想让 ChromeDriver 在最新版本上运行,而 Chrome 在最新版本上运行。让它发挥作用的神奇线路是:

ChromeOptions options = new ChromeOptions();
options.AddArguments("no-sandbox"); <--------------------------
driver = new ChromeDriver(options);

此行阻止 ChromeDriver 尝试以 SYSTEM 用户身份打开 Chrome,而他无法使用 VSO 代理来处理此问题。

关于selenium - 将 Selenium 测试与 tfs 集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38659575/

相关文章:

java - 如何在 TestNG 中获取测试组名称

java - 如何使用Java(用于selenium自动化)获取段落标签内的文本(div/div/p)

ruby-on-rails - Capybara 可以使用 Selenium Iphone 驱动程序吗?

tfs - 个人访问 token 不适用于 TFS 2017 包源

c# - NUnit 测试错误 'Could not load file or assembly..'

javascript - 需要将 Chrome 开发工具中的性能监视器详细信息捕获到 Java 程序中

visual-studio-2010 - 是否可以在 VS2010 中使用 VisualStudio.com?

azure - 将另一个 AD 中的用户添加到我的团队项目中

C#、NUnit : Clear way of testing that ArgumentException has correct ParamName

c# - 如果我的代码是为 x86 或任何 CPU 编译的,我的代码如何在运行时检测到