static void Main(string[] args) { User user = new User(); IWebDriver driver = new FirefoxDriver(); WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(11)); RegistrationPageLocators registrationPageLocators = new RegistrationPageLocators(); RegistrationPage registrationPage = new RegistrationPage(driver); registrationPage.GoToRegistrationPage(driver); HomePage homePage = registrationPage.RegistrationUserSuccesful(user, wait, registrationPageLocators); HomePageLocators homePageLocators = new HomePageLocators(); MessagesPage messagesPage = homePage.GoToMessagesPage(driver, homePageLocators, wait); MessagesPageLocators messagesPageLocators = new MessagesPageLocators(); LastDialogPage lastDialogPage = messagesPage.GoToLastDialog(driver, messagesPageLocators, wait); LastDialogLocators lastDialogLocators = new LastDialogLocators(); Console.WriteLine("Last mesage : " + lastDialogPage.GetTextOfLastMessage(driver, lastDialogLocators, wait)); driver.Quit(); }
/// <summary> /// Get text of last message. /// </summary> /// <param name="driver"></param> /// <param name="lastDialogLocators"></param> /// <param name="wait"></param> /// <returns>Text of last message.</returns> public string GetTextOfLastMessage(IWebDriver driver, LastDialogLocators lastDialogLocators, WebDriverWait wait) { return(wait.Until(ExpectedConditions.ElementIsVisible(lastDialogLocators.lastMassageLocator)).Text); }