示例#1
0
        public BaseElement WaitForElementToBeClickable()
        {
            var wait = new WebDriverWait(WebdriverFactory.GetCurrentDriver(), TimeSpan.FromSeconds(Timeout));

            wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementToBeClickable(Locator));
            return(this);
        }
示例#2
0
        public BaseElement AssertAbsent()
        {
            IList <IWebElement> list = WebdriverFactory.GetCurrentDriver().FindElements(Locator);

            if (list.Count > 0)
            {
                Assert.IsFalse(list[0].Displayed);
            }
            return(this);
        }
示例#3
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();
        }
示例#4
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();
        }
示例#5
0
 public IWebElement GetWebElement()
 {
     return(WebdriverFactory.GetCurrentDriver().FindElement(Locator));
 }
示例#6
0
 public void startBrowser()
 {
     WebdriverFactory.OpenNewBrowser();
     WebdriverFactory.GetCurrentDriver().Manage().Window.Maximize();
 }
示例#7
0
 public void closeBrowser()
 {
     WebdriverFactory.GetCurrentDriver().Close();
     WebdriverFactory.ClearUpDriver();
 }