/// <summary> /// Logs in a user. /// First navigates to the site home page, clicks on the login link, then enters the users username and password and clicks login. /// </summary> /// <param name="name">The username for the user.</param> /// <param name="password">The password for the user.</param> public void LoginUser(string name, string password, bool expectToLogin, int portalId) { var user = UserController.GetUserByName(portalId, name); var regLinkText = RegisterLink.Text; if (regLinkText == user.DisplayName) { return; } if (LoginLink.Text == "Logout") { LoginLink.ClickNoWait(); IEInstance.WaitUntilContainsText("Login"); } LoginLink.Click(); UserNameField.Value = name; PasswordField.Value = password; RememberMeCheckBox.Checked = true; LoginButton.ClickNoWait(); if (expectToLogin) { IEInstance.WaitUntilContainsText("Logout"); } }
/// <summary> /// Logs in a user. /// First navigates to the site home page, clicks on the login link, then enters the users username and password and clicks login. /// </summary> /// <param name="name">The username for the user.</param> /// <param name="password">The password for the user.</param> public void LoginUser(string name, string password) { IEInstance.GoTo(SiteUrl); System.Threading.Thread.Sleep(1500); if (LoginLink.Text != "Login") { return; } LoginLink.Click(); System.Threading.Thread.Sleep(1500); UserNameField.Value = name; PasswordField.Value = password; LoginButton.ClickNoWait(); System.Threading.Thread.Sleep(2500); }