我們使用MSTest
與Team服務(Visual Studio的在線)建立來運行我們的Selenium測試Visual Studio團隊服務(VS在線)運行測試時失敗。 FirefoxDriver
和InternetExplorerDriver
正在正常運行,但是ChromeDriver
和OperaDriver
是失敗每次,甚至沒有能夠打開瀏覽器。 他們用下面的堆棧跟蹤每次失敗:ChromeDriver和OperaDriver上
Initialization method WebUnitTests.Tests.DatacenterTests.TestInitialize threw exception. OpenQA.Selenium.WebDriverException:
OpenQA.Selenium.WebDriverException: The HTTP request to the remote WebDriver server for URL http://localhost:1410/session timed out after 60 seconds. --->
System.Net.WebException: The operation has timed out.
at System.Net.HttpWebRequest.GetResponse()
at OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest request)
--- End of inner exception 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 WebUnitTests.Framework.Utilities.Driver.StartBrowser(BrowserTypes browserType, Int32 defaultTimeOut) in C:\agent2\_work\1\s\WebUnitTests\Framework\Utilities\Driver.cs:line 37
at WebUnitTests.Framework.Utilities.BaseTests.InitializeBrowser(TestContext testContext) in C:\agent2\_work\1\s\WebUnitTests\Framework\Utilities\BaseTests.cs:line 328
at WebUnitTests.Framework.Utilities.BaseTests.TestInitialize() in C:\agent2\_work\1\s\WebUnitTests\Framework\Utilities\BaseTests.cs:line 147
什麼我使用啓動驅動程序:提
var chromeOptions = new ChromeOptions();
chromeOptions.AddArgument("--ignore-certificate-errors");
var chromeBrowser = new ChromeDriver(chromeOptions);
一個非常重要的事情是,如果我跑在我的測試本地機器一切正常,只有當它們在CI中運行時纔會出現問題。
任何想法,我可以嘗試找到根問題?任何解決方法來解決這個問題?
您是否將構建/測試代理配置爲以交互模式運行?如果您手動在構建/測試代理上運行測試,它會成功運行嗎? –