jeudi 23 novembre 2017

Selenium tests fail in the sleep method

Even though the test bypasses the necessary step we get the failure as a result.

The code error line is : SmokeTesting.Toolbox.Timer.SleepTime();

Error message

Test method xxxxxx.SmokeTestUser.TestingLoginEmailUser threw exception: 
OpenQA.Selenium.WebDriverException: The HTTP request to the remote WebDriver server for URL http://xxxxxxx:4444/wd/hub/session/63fc39d6-e848-406f-bdd2-4b7053553d85/element timed out after 60 seconds. ---> System.Net.WebException: The operation has timed out

Stack Trace

at System.Net.HttpWebRequest.GetResponse() at OpenQA.Selenium.Remote.HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo requestInfo) --- End of inner exception stack trace --- at OpenQA.Selenium.Remote.HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo requestInfo) at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute) at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) at OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(String mechanism, String value) at OpenQA.Selenium.Remote.RemoteWebDriver.FindElementById(String id) at OpenQA.Selenium.By.<>c__DisplayClass16_0.b__0(ISearchContext context) at OpenQA.Selenium.By.FindElement(ISearchContext context) at OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(By by) at End2EndAutomationTest.SmokeTestBasic.TestingLoginEmailAdmin() in C:\agent_work\49\s\End2EndAutomationTest\End2EndAutomationTest\Test\SmokeTestAdmin.cs:line 35

Code

using (var driver = Constants.createDriver())

           {
                driver.Navigate().GoToUrl("https://xxx-xxxx-" + environment + ".azurewebsites.net");
                Console.WriteLine(driver.Title);
                driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(240);
                driver.FindElement(By.Id("login")).Click();
                SmokeTesting.Toolbox.Timer.SleepTime();
                driver.FindElement(By.Id("cred_userid_inputtext")).SendKeys(username);
                driver.FindElement(By.Id("cred_password_inputtext")).SendKeys(password);
                driver.FindElement(By.Id("cred_sign_in_button")).Click();
                SmokeTesting.Toolbox.Timer.SleepTime();
                driver.FindElement(By.Id("userRegistratio

Aucun commentaire:

Enregistrer un commentaire