Beispiel #1
0
        public void LoginAndLogOut(String BrowserName) //
        {
            try
            {
                Initialize(BrowserName);
                driver.Navigate().GoToUrl("https://www.zalando.nl/dames-home/");
                LoginUserPage page = new LoginUserPage(driver, waitf);
                PageFactory.InitElements(driver, page);

                page.LoginLableClick();
                waitf.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.Id("login.email")));
                page.InsertLoginValue(page.LoginEmail, "*****@*****.**");
                page.InsertLoginValue(page.LoginPassword, "Test_Olga77");
                waitf.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.VisibilityOfAllElementsLocatedBy(By.Id("uc-btn-accept-banner")));
                driver.FindElement(By.Id("uc-btn-accept-banner")).Click();
                page.LoginUser();
                waitf.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.UrlContains("myaccount"));
                Assert.AreEqual(@"https://www.zalando.nl/myaccount/", driver.Url);

                page.LoginLableClick();
                page.LogOutUser();
                driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
                waitf.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.UrlContains("https://www.zalando.nl/"));
                Assert.AreEqual(@"https://www.zalando.nl/", driver.Url);
            }
            catch (NoSuchElementException ex)
            { test.Fail(ex.StackTrace); }
        }