예제 #1
0
        public void  Login(String userName, String password)
        {
            SeleniumGetMethod.WaitForPageLoad(driver);
            new WebDriverWait(driver, TimeSpan.FromSeconds(30)).Until(ExpectedConditions.ElementIsVisible((By.CssSelector("input[name=UserName]"))));
            //Enter UserName and Password to launch intoSystem
            UserName.EnterText(userName);
            UserPassword.EnterText(password);
            new WebDriverWait(driver, TimeSpan.FromSeconds(30)).Until(ExpectedConditions.ElementToBeClickable((By.CssSelector("div.form-group.mt30 >a[class*=button]"))));
            btnLogin.Click();
            SeleniumGetMethod.WaitForPageLoad(driver);
            //waiting to ensure that we can obtain current url properly
            Thread.Sleep(5000);
            //check correct login
            string currentUrl = driver.Url;

            Console.WriteLine(currentUrl);
            bool isLoginSuccesful = currentUrl.Contains("ModuleItems");

            Assert.IsTrue(isLoginSuccesful);
            if (isLoginSuccesful)
            {
                PropertiesCollection._reportingTasks.Log(Status.Info, "<b>LOGIN SUCCESSFUL</b> ");
            }
        }
예제 #2
0
        //Login Form credentials
        public void LoginApplication()
        {
            int selectEnviornment = Constant.VersionNumber;

            switch (selectEnviornment)
            {
            case 1:
                //             LanguageSelect.SendKeys(Keys.ArrowDown);
                Thread.Sleep(1500);
                UserName.EnterText(Constant.newClientUser);
                UserPassword.EnterText(Constant.loginPassword);
                Thread.Sleep(500);
                Browser.Driver.FindElement(By.XPath("//*[@id='loginForm']/div[2]/div[4]/div/p/button")).ClickOn();
                //    Thread.Sleep(1500);
                if (Pages.Home_Page.AppointmentBtn_1.Displayed)
                {
                    //nothing
                }
                else if (Pages.Home_Page.AppointmentBtn_2.Displayed)
                {
                    SideBarArrow.ClickOn();
                }
                break;

            case 2:
                //       LanguageSelect.SendKeys(Keys.ArrowDown);
                Thread.Sleep(1500);
                UserName.EnterText(Constant.testUser);
                UserPassword.EnterText(Constant.loginPassword);
                Thread.Sleep(500);
                Browser.Driver.FindElement(By.XPath("//*[@id='loginForm']/div[2]/div[4]/div/p/button")).ClickOn();
                Thread.Sleep(1500);
                if (Pages.Home_Page.AppointmentBtn_1.Displayed)
                {
                    //nothing
                }
                else if (Pages.Home_Page.AppointmentBtn_2.Displayed)
                {
                    SideBarArrow.ClickOn();
                }
                break;

            case 3:
                Pages.MobileTherapist_Page.MobileLogin();
                break;

            case 4:
                //        LanguageSelect.SendKeys(Keys.ArrowDown);
                Thread.Sleep(1500);
                UserName.EnterText(Constant.newClientUser);
                UserPassword.EnterText(Constant.prodPassword);
                Thread.Sleep(500);
                Browser.Driver.FindElement(By.XPath("//*[@id='loginForm']/div[2]/div[4]/div/p/button")).ClickOn();
                Thread.Sleep(1500);
                if (Pages.Home_Page.AppointmentBtn_1.Displayed)
                {
                    //nothing
                }
                else if (Pages.Home_Page.AppointmentBtn_2.Displayed)
                {
                    SideBarArrow.ClickOn();
                }
                break;
            }
        }
예제 #3
0
 public void LoginMiddleTest(string name, string password)
 {
     UserName.EnterText(name);
     UserPassword.EnterText(password);
 }