Ejemplo n.º 1
0
        /// <summary>
        /// Enters text in the username and password field, clicks the login button, then waits for the URL
        /// of the Dashboard page to load
        /// </summary>
        /// <param name="userName">The cme360 username</param>
        /// <param name="password"></param>
        public MyDashboardPage Login(string userName, string password)
        {
            // Login with a valid user
            UserNameTxt.Clear();
            PasswordTxt.Clear();
            UserNameTxt.SendKeys(userName);
            PasswordTxt.SendKeys(password);
            PasswordTxt.SendKeys(Keys.Tab);
            MyDashboardPage page = ClickAndWait(LoginBtn);

            return(page);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Clicks the user-specified element and then waits for a window to close or open, or a page to load, depending on the element that was clicked
        /// </summary>
        /// <param name="buttonOrLinkElem">The element to click on</param>
        public dynamic ClickAndWait(IWebElement buttonOrLinkElem)
        {
            if (Browser.Exists(Bys.LoginPage.LoginBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == LoginBtn.GetAttribute("outerHTML"))
                {
                    LoginBtn.Click();
                    //new WebDriverWait(Browser, TimeSpan.FromSeconds(20)).Until(ExpectedConditions.UrlContains("Default2"));
                    MyDashboardPage page = new MyDashboardPage(Browser);
                    return(page);
                }
            }

            else
            {
                throw new Exception("No button or link was found with your passed parameter. You either need to add this button to a new If statement, or if the button is already added, then the page you were on did not contain the button.");
            }

            return(null);
        }