Exemplo n.º 1
0
        public BaseElement WaitForElementToBeClickable()
        {
            var wait = new WebDriverWait(WebdriverFactory.GetCurrentDriver(), TimeSpan.FromSeconds(Timeout));

            wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementToBeClickable(Locator));
            return(this);
        }
Exemplo n.º 2
0
        public static IWebDriver CreateWebDriver()
        {
            IWebDriver _driver = WebdriverFactory.GetWebdriver(ConfigurationManager.AppSettings["Browser"]);

            _driver.Manage().Window.Maximize();
            _driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(10);
            return(_driver);
        }
Exemplo n.º 3
0
        public BaseElement AssertAbsent()
        {
            IList <IWebElement> list = WebdriverFactory.GetCurrentDriver().FindElements(Locator);

            if (list.Count > 0)
            {
                Assert.IsFalse(list[0].Displayed);
            }
            return(this);
        }
Exemplo n.º 4
0
        public void verifyLoginWithWrongToken()
        {
            string wrongToken = "wrong";

            WebdriverFactory.GetCurrentDriver().Url = WebdriverFactory.ApplicationUrl;

            new MainPage().GetLoginButton().Click();
            LoginPage loginPage = new LoginPage();

            loginPage.GetLoginSubmitButton().WaitForElementToBePresent().AssertDisabled();
            loginPage.GetTokenTextField().SetValue(wrongToken);
            loginPage.GetLoginSubmitButton().Click();

            loginPage.GetInvalidTokenMessage().WaitForElementToBePresent().AssertExists();
        }
Exemplo n.º 5
0
        public void VerifyCreationAndDeletionOfCategory()
        {
            string categoryName = DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss.fff");

            LoginHelper.Login();

            new MainPage().GetCategoriesButton().Click();
            CategoriesPage categoriesPage = new CategoriesPage();

            categoriesPage.GetCreateNewCategoryButton().Click();

            CreateCategoryPage createCategoryPage = new CreateCategoryPage();

            createCategoryPage.GetCategotyNameTextField().SetValue(categoryName);
            createCategoryPage.GetSubmitButton().Click();
            categoriesPage = new CategoriesPage();
            categoriesPage.GetCategoryRowByName(categoryName).WaitForElementToBePresent().AssertExists();

            categoriesPage.GetDeleteButtonByCategoryName(categoryName).Click();
            WebdriverFactory.GetCurrentDriver().SwitchTo().Alert().Accept();

            categoriesPage.GetCategoryRowByName(categoryName).WaitForElementToBeAbsent().AssertAbsent();
        }
Exemplo n.º 6
0
 public IWebElement GetWebElement()
 {
     return(WebdriverFactory.GetCurrentDriver().FindElement(Locator));
 }
Exemplo n.º 7
0
 public void startBrowser()
 {
     WebdriverFactory.OpenNewBrowser();
     WebdriverFactory.GetCurrentDriver().Manage().Window.Maximize();
 }
Exemplo n.º 8
0
 public void closeBrowser()
 {
     WebdriverFactory.GetCurrentDriver().Close();
     WebdriverFactory.ClearUpDriver();
 }