public LogInForm OpenLoginForm() { try { //Click Sign in button SignInButton.JSclick(_signInButtonBy); WaitTillElementIsVisible(_logInInputBy); if (RussianLanguageIsSelected.Displayed) { RussianLanguageIsSelected.Click(); WaitTillElementIsVisible(_contentBy); EnglishLanguage.Click(); WaitTillElementIsVisible(_nextButtonBy); } } catch (Exception ex) { Log.Error(ex, "Log in form was not opened"); } return(new LogInForm()); }
public MainEmailBoxPage LogInToEmailBox(string email, string password) { try { HomePage homePage = new HomePage(); IWebDriver driver = Browser.GetDriver(); driver.Manage(); LogInForm logInForm = new LogInForm(); WaitTillElementIsVisible(_logInForm); if (RussianLanguageIsSelected.Displayed) { RussianLanguageIsSelected.Click(); WaitTillElementIsVisible(_contentBy); EnglishLanguage.Click(); WaitTillElementIsVisible(_logInForm); } if (driver.IsElementDisplayed(_changeUserButton)) { ChangeUserButton.Click(); } if (driver.IsElementDisplayed(_useAnotherAccountBy)) { logInForm.UseAnotherAccountButton.Click(); } //Enter credentials logInForm.WaitTillElementIsVisible(_loginInputBy); logInForm.LogInInput.SendKeys(email); logInForm.NextEmailButton.Click(); logInForm.WaitTillElementIsVisible(_passwordInputBy); logInForm.PasswordInput.SendKeys(password); logInForm.PasswordInput.HighlightElement(_passwordInputBy); logInForm.NextPasswordButton.Click(); //Wait till main mail box page is loaded MainEmailBoxPage mainEmailBoxPage = new MainEmailBoxPage(); mainEmailBoxPage.WaitTillElementIsVisible(_composeButtonBy); Logger.Configure(); Log.Information($"I login with the following credentials: '{email}' / '{password}'"); } catch (Exception ex) { Logger.Configure(); Log.Error(ex, "Log in to the email box was failed"); } return(new MainEmailBoxPage()); }