public void IsLogin(String user)
        {
            WindowsMessages w = new WindowsMessages();

            //Go to Desk Page
            _reportingTasks.CreateNode("User Authorization action");
            Goto(_config.PlmUrl);
            SeleniumGetMethod.WaitForPageLoad(driver);
            //If User not login
            if (driver.Url.IndexOf("plmOn/Desk/", StringComparison.OrdinalIgnoreCase) == -1)
            {
                SeleniumGetMethod.WaitForPageLoad(driver);
                //Go to Login page
                driver.Navigate().GoToUrl(_config.PlmUrlDef);
                var pagelogin = _pages.GetPage <LoginPageObjects>();
                pagelogin.Login(user, _config.Password);

                _reportingTasks.Log(Status.Info, user + " Login in the system");
                SeleniumGetMethod.WaitForPageLoad(driver);
            }
            else
            {
                if (browserName == "Edge")
                {
                    driver.ExecuteJavaScript(@"window.onbeforeunload = function(){}");
                }
            }
        }
Exemplo n.º 2
0
        public void  Login(String userName, String password)
        {
            //new WebDriverWait(Driver, TimeSpan.FromSeconds(30)).Until(ExpectedConditions.ElementExists((By.Id("cmdLogin"))));
            //userName
            SeleniumGetMethod.WaitForPageLoad(driver);
            txtUserName.Click();
            txtUserName.EnterText(userName);
            new WebDriverWait(driver, TimeSpan.FromSeconds(2000)).Until(ExpectedConditions.ElementExists((By.Id("txtUserPass"))));
            ////user password
            txtUserPass.Click();
            txtUserPass.EnterText(password);
            ////Click button
            System.Threading.Thread.Sleep(1000);
            btnLogin.Click();
            System.Threading.Thread.Sleep(4000);

            //Check correct Login
            string DeskURL   = driver.Url;
            string message   = "login faild";
            Char   delimiter = '?';

            String[] substrings = DeskURL.Split(delimiter);
            var      parseDesk  = substrings[0];

            Assert.AreEqual(parseDesk, TestsInputData.AutomationSettings.Desk, message);
        }