硒不会在警报时做出反应

时间:2016-08-11 13:06:19

标签: c# selenium selenium-webdriver alert

在我们的网络应用程序中,如果用户尝试从列表中删除项目,他将获得确认窗口,其中包含确认操作的要求。在自动测试的代码中,它的工作原理如下:

SetMethods.ClickElement(By.Id(General.StitchId(button_combine, childPosition))); //click on delete button
WaitUntilSmth.WaitLittle.Until(ExpectedConditions.AlertIsPresent()); //waiting for window
Driver.browser.SwitchTo().Alert().Accept(); 

两天前所有测试都运行正常。昨天的测试开始失败 ExpectedConditions.AlertIsPresent(),例外情况:

  

对远程WebDriver服务器的URL请求   http://localhost:54623/session/4d597cd674e654ace5ac79c9a516cd61/alert_text   60秒后超时。       System.Exception {OpenQA.Selenium.WebDriverException}

出现警报,webdriver等待一分钟,然后失败。

堆栈跟踪:

OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL http://localhost:55632/session/b4277da23ac26cc6ce309e5a35c231a8/alert_text timed out after 60 seconds.
    ----> System.Net.WebException : The request has been interrupted: The waiting time of operation has expired.
    in OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest request)
    in OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute)
    in OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute(Command commandToExecute)
    in OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
    in OpenQA.Selenium.Remote.RemoteTargetLocator.Alert()
    in OpenQA.Selenium.Support.UI.ExpectedConditions.<AlertIsPresent>b__4c(IWebDriver driver)
    in OpenQA.Selenium.Support.UI.DefaultWait`1.Until[TResult](Func`2 condition)
    in Expo2.Utility.General.AcceptAlert() в g:\Git\expo-2\Tests\NewSeleniumTests\Expo2\Utility\General.cs: string 144
    in Expo2.Tests.Catalogs.Support.DeleteChild(String Name, String subMenu, String subSubMenu, String elementText, Int32 childNumber, String[] button_combine) in g:\Git\expo-2\Tests\NewSeleniumTests\Expo2\Tests\Catalogs\Support.cs: string 143
    in Expo2.Tests.Catalogs.ActivitiesTest.DeleteChild(String elementText, Int32 childNumber) in g:\Git\expo-2\Tests\NewSeleniumTests\Expo2\Tests\Catalogs\ActivitiesTest.cs:string 123
    in Expo2.Tests.Catalogs.ActivitiesTest.FullTestActivities()in g:\Git\expo-2\Tests\NewSeleniumTests\Expo2\Tests\Catalogs\ActivitiesTest.cs: string 181
    --WebException
    in System.Net.HttpWebRequest.GetResponse()
    in OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest request)

同时,在测试服务器上部署期间,所有测试都正确执行。它们在所有本地计算机上都失败了。

上周,测试人员和开发人员都没有对测试或网络应用程序进行任何更改。

  • 浏览器Chrome 52.0.2743.116
  • Selenium WebDriver 2.53.1
  • chromedriver 2.23
  • C#上的自动测试

是否有人面临同样的情况?

谢谢!

0 个答案:

没有答案