Ejemplo n.º 1
0
        public void LoginToApplication(string username, string password, log4net.ILog log)
        {
            log.Info("in login method");



            //Check if Ts&Cs need to be accepted (first time visit)



            try
            {
                UserName.Clear();
            }
            catch (TargetInvocationException)
            {
                PageFactory.InitElements(driver, this);
                UserName.Clear();
            }
            UserName.SendKeys(username);
            Password.SendKeys(password);
            Login_Securely_button.Submit();
            log.Info("Login Successful");

            try
            {
                chk_TCs.Click();
                btn_TCsSubmit.Click();
            }
            catch
            {
                //Nothing to do - page not present
            }
        }
Ejemplo n.º 2
0
        public void LoginToApplicationNoAutoAuth(string username, string password, log4net.ILog log)
        {
            log.Info("Gone to Login To ApplicationNoAuth");

            try
            {
                Login_link.Click();
                log.Info("Clicked Login button");
                UserName.SendKeys(username);
                Password.SendKeys(password);
                Login_Securely_button.Submit();

                log.Info("Login submitted");
            }
            catch (Exception ex)
            {
                try
                {
                    driver.FindElement(By.XPath("//*[@name='HasAccepted' and @type='checkbox']")).Click();
                    driver.FindElement(By.XPath("//*[@value='Submit'")).Click();
                }
                catch
                {
                    log.Error("Failed to Submit login details");

                    throw new Exception(ex.Message);
                }
            }
        }