title: Selenium Webdriver: wait until text is present on page
body: <p>I've tried this:</p>
  
  <pre><code>driver.wait(function() {
    return driver.isElementPresent(webdriver.findElement(By.xpath("//*[contains(text(),'Vanilla Sky Final Scene')]")))
  }, 20000).then(function() {
    console.log('worked')
  })
  </code></pre>
  
  <p>and this:</p>
  
  <pre><code>driver.wait(function() {
    return driver.isElementPresent(driver.findElement(By.xpath("//*[contains(text(),'Vanilla Sky Final Scene')]")))
  }, 20000).then(function() {
    console.log('worked')
  })
  </code></pre>
  
  <p>And this:</p>
  
  <pre><code>driver.wait(function() {
    return driver.findElement(By.xpath("//*[contains(text(),'Vanilla Sky Final Scene')]")))
  }, 20000).then(function() {
    console.log('worked')
  })
  </code></pre>
  
  <p>None of them seem to work. What's the right way to do it?</p>