当测试时间超过10分钟时,Selenium webdriver崩溃

时间:2013-11-21 19:43:41

标签: c# selenium selenium-webdriver

我正在测试一个有20多个部分的筛选应用程序。到目前为止,短于5-10分钟的测试工作正常。但是我有一个测试应该在理想条件下完成整个应用程序,并且测试需要更长的时间,似乎每次都在同一点失败。我收到了错误

Test 'ScreeningTests.ScreeningPageTest("firefox").CompleteScreeningTest()' failed: OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL http://localhost:7055/hub/session/c8495f3b-b8ec-4f19-80d3-b1e7bdea8265/element/%7Ba2d949ed-768f-479d-92de-ba3ede415785%7D/click timed out after 60 seconds.
 ----> System.Net.WebException : The operation has timed out
at OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest request)
at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute)
at OpenQA.Selenium.Firefox.Internal.ExtensionConnection.Execute(Command commandToExecute)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebElement.Click()
Pages\Screening\TestPage.cs(416,0): at AFTLibrary.Pages.Screening.TestPage.ContinueScreening()
Pages\Screening\ScreeningPage.cs(131,0): at AFTLibrary.Pages.Screening.ScreeningPage.Continue()
Pages\Screening\ScreeningPage.cs(53,0): at AFTLibrary.Pages.Screening.ScreeningPage.ContinueScreening()
ScreeningPageTest.cs(80,0): at ScreeningTests.ScreeningPageTest.CompleteScreeningTest()
--WebException
at System.Net.HttpWebRequest.GetResponse()
at OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest request)

0传递,1失败,0跳过,耗时759.38秒(NUnit 2.6.1)。

我对这个错误的第一反应是'哦,它找不到它应该点击的按钮'但是那个按钮被加载到每个前面的页面上,而webdriver没有找到它的问题。我认为这是webdriver本身的超时。我在网上查了一下,发现像使用'隐式等待'和'设置页面加载超时'的建议,但这并没有真正解决我的问题。我正在使用Selenium for Dot NET,这就是我初始化我的webdriver

的方法
    static public IWebDriver GetBrowser()
    {
       IWebDriver driver = new FirefoxDriver();    
       driver.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(3000));
       return driver;
    }

有谁知道如何解决这个问题?

0 个答案:

没有答案
相关问题