2015-08-20 65 views
2

我正在使用TeamCity(v8.0.5)運行使用Selenium WebDriver(v 2.47)的測試。到了這個時候一切都工作在ChromeDriver(V 2.16),但serveral的天前,它只是停止工作,錯誤如下:OpenQA.Selenium.WebDriverException:向遠程WebDriver服務器發送URL的HTTP請求超時

[19:34:04][chrome] Starting ChromeDriver 2.16.333243 (0bfa1d3575fc1044244f21ddb82bf870944ef961) on port 49354 
[19:34:04][chrome] Only local connections are allowed. 
[19:35:07][chrome] 
[19:35:07][chrome] Unhandled Exception: OpenQA.Selenium.WebDriverException: The HTTP request to the remote WebDriver server for URL http://localhost:49354/session timed out after 60 seconds. ---> System.Net.WebException: The operation has timed out 
[19:35:07][chrome] at System.Net.HttpWebRequest.GetResponse() 
[19:35:07][chrome] at OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest request) in c:\Projects\webdriver\dotnet\src\webdriver\Remote\HttpCommandExecutor.cs:line 141 
[19:35:07][chrome] --- End of inner exception stack trace --- 
[19:35:07][chrome] at OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest request) in c:\Projects\webdriver\dotnet\src\webdriver\Remote\HttpCommandExecutor.cs:line 151 
[19:35:07][chrome] at OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute(Command commandToExecute) in c:\Projects\webdriver\dotnet\src\webdriver\Remote\DriverServiceCommandExecutor.cs:line 78 
[19:35:07][chrome] at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) in c:\Projects\webdriver\dotnet\src\webdriver\Remote\RemoteWebDriver.cs:line 910 
[19:35:07][chrome] at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities) in c:\Projects\webdriver\dotnet\src\webdriver\Remote\RemoteWebDriver.cs:line 88 
[19:35:07][chrome] at MWLIS.WebUI.UITests.MwlisChromeDriverWrapper.Initialize() in c:\TeamCity\buildAgent\work\5274d544715210e7\src\MWLIS.WebUI.UITests\Program.cs:line 170 
[19:35:07][chrome] at OpenWaves.UITesting.Runner.ScenarioRunner.RunScenariosWithDriver(IEnumerable`1 scenarios, WebDriverWrapperBase driver) in c:\SVN\OpenWaves.UITesting\OpenWaves.UITesting\Runner\ScenarioRunner.cs:line 33 
[19:35:07][chrome] at OpenWaves.UITesting.Runner.TeamCityScenarioRunner.RunScenariosWithDriver(IEnumerable`1 scenarios, WebDriverWrapperBase driver) in c:\SVN\OpenWaves.UITesting\OpenWaves.UITesting\Runner\TeamCityScenarioRunner.cs:line 41 
[19:35:07][chrome] at OpenWaves.UITesting.Runner.ScenarioRunner.Run(Func`2 getTestsFunc) in c:\SVN\OpenWaves.UITesting\OpenWaves.UITesting\Runner\ScenarioRunner.cs:line 26 
[19:35:07][chrome] at MWLIS.WebUI.UITests.Program.Main(String[] args) in c:\TeamCity\buildAgent\work\5274d544715210e7\src\MWLIS.WebUI.UITests\Program.cs:line 69 

我懷疑,也許Chrome的更新導致此問題,但它給了我FirefoxDriver和InternetExplorerDriver的結果相同。我還懷疑我在測試中執行的「無聲」Windows身份驗證(將用戶名和密碼作爲url的一部分傳遞),但我設法在TeamCity託管的同一臺服務器上本地運行測試,所以我沒有確定問題的根本原因是什麼。

我在這個論壇上看到很多關於Selenium超時的類似問題,像這個OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server timeout或這個Selenium tests, Continuous Integration. The HTTP request to the remote WebDriver server for URL http://localhost,但沒有答案對我有幫助。

任何想法?請幫忙。

回答

2

好的,我發現了這個問題的解決方法。我通過PhatnomJSDriver從「真實」的瀏覽器切換到PhantomJS,現在我不再觀察這些超時了。

另一種方法是爲我工作的BrowserStack雲平臺(https://www.browserstack.com),它允許在任何瀏覽器,任何使用RemoteWebDriver和瀏覽器功能的操作系統上進行測試。

我希望有人覺得這有用。

+0

太棒了!我與webdrive模擬問題超時usnig chromedriver。我會測試建議的解決方法 –

相關問題