示例#1
0
        public void IsLogin(String user)
        {
            // go to Sign In Page
            _reportingTasks.CreateNode("User Authorization action");
            Goto(_config.PlmUrl);
            SeleniumGetMethod.WaitForPageLoad(driver);
            var pagelogin = _pages.GetPage <LoginPageObjects>();

            pagelogin.Login(user, _config.Password);
            SeleniumGetMethod.WaitForPageLoad(driver);
            // in case of failed login
            if (driver.Url.IndexOf("ModuleItems", StringComparison.OrdinalIgnoreCase) == -1)
            {
                SeleniumGetMethod.WaitForPageLoad(driver);
                // go to Login page
                driver.Navigate().GoToUrl(_config.PlmUrlDef);
                var logPage = _pages.GetPage <LoginPageObjects>();
                pagelogin.Login(user, _config.Password);
                _reportingTasks.Log(Status.Info, user + " Login in the system once again");
                SeleniumGetMethod.WaitForPageLoad(driver);
            }
        }
示例#2
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> ");
            }
        }