public void VerifySentFolder(string username, string password) { Login(username, password); WaitUntilElementDisplayed(driver, By.CssSelector("div[gh='cm']")); NewEmailButton.Click(); WaitUntilElementDisplayed(driver, By.XPath("//textarea[@aria-label='To']")); NewEmailToInput.SendKeys("*****@*****.**"); NewEmailSubjectInput.SendKeys(subjectToSend); SendEmailButton.Click(); WaitUntilElementDisplayed(driver, By.XPath("//*[@data-tooltip='Sent']")); SentFolder.Click(); List <IWebElement> emails = driver.FindElements(By.CssSelector("div[class = 'ae4 UI']> div>div>table>tbody>tr")).ToList(); foreach (IWebElement email in emails) { if (email.Text.Contains(subjectToSend) == true) { email.Click(); break; } else { driver.Close(); } } }
public void VerifyInboxFolder(string username, string password, string username1, string password1) { Login(username, password); WaitUntilElementDisplayed(driver, By.CssSelector("div[gh='cm']")); NewEmailButton.Click(); WaitUntilElementDisplayed(driver, By.XPath("//textarea[@aria-label='To']")); NewEmailToInput.SendKeys("*****@*****.**"); NewEmailSubjectInput.SendKeys(subjectToSend); WaitUntilElementDisplayed(driver, By.XPath("//*[@data-tooltip='Sent']")); SendEmailButton.Click(); Thread.Sleep(1000); WaitUntilElementDisplayed(driver, By.XPath("//*[contains(@aria-label, 'Selenium')]")); LoggedUser.Click(); WaitUntilElementDisplayed(driver, By.XPath("//*[@id = 'gb_71']")); SignOutButton.Click(); driver.Quit(); //var Driver = new ChromeDriver(@"D:\Automation"); PageObject gmail = new PageObject(driver); NavigateTo(); //Login(username1, password1); //List<IWebElement> emails = driver.FindElements(By.CssSelector("div[class = 'ae4 aDM']> div>div>table>tbody>tr")).ToList(); //foreach (IWebElement email in emails) //{ // if (email.Text.Contains(sss) == true) // { // email.Click(); // break; // } // else // { // driver.Close(); // } //} }