title: Selenium wait until email is sent
body: <p>I am writing a simple program that tests the functionality of gmail and this include sending an email.</p>
  
  <p>I have the program send an email, and once it is acknowledged that it has been sent, it logs out. </p>
  
  <p>I do not want to logout <em>while</em> the message is being sent, only when it is done.</p>
  
  <p>So, if you have gmail and when you send a message you see a little notification above your inbox which says "Your message has been sent. View message."</p>
  
  <p>The cssSelector for that is div.vh.</p>
  
  <p>So I want my program to wait until that window pops up before I log out. </p>
  
  <p>But sometimes it logs out before the message appears due to internet speed. </p>
  
  <p>Here is my code: </p>
  
  <pre><code>WebElement element = (new WebDriverWait(driver,10)).until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("div.vh")));
  </code></pre>