Пример #1
0
        public static void SelectDropDownRandom(IWebElement element)
        {
            int allOptions = SeleniumGetMethod.GetQuantityOfOptionsInDropDown(element);

            if (allOptions == 0)
            {
                PropertiesCollection._reportingTasks.Log(Status.Info, "<b> There are no options in drop down list...</b>");
                return;
            }
            try
            {
                SelectDropDown(element, Helpers.Randomizer.Number(1, allOptions));
            }
            catch (Exception e)
            {
                PropertiesCollection._reportingTasks.Log(Status.Info, "<b>Can't select default value from drop down list...</b><br>" + e.ToString());
            }
        }
Пример #2
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);
            }
        }
Пример #3
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> ");
            }
        }