title: Selenium Javascript Get title from Google
body: <p>All I want to do is something really simple but I'm having such a hard time with it.  I want to retrieve the title from Google and print it using Javascript and driver. </p>
  
  <p>Here's my code:</p>
  
  <pre><code>const {Builder, By, Key, until} = require('selenium-webdriver');
  var driver = new Builder().forBrowser('internet explorer').build();
  driver.get("https://www.google.com/");
  var title = driver.executeScript("return document.title;");
  console.log("Title: " + title);
  </code></pre>
  
  <p>Here's my error: </p>
  
  <pre><code>Title: [object Promise]                                                                                                         
  (node:5412) UnhandledPromiseRejectionWarning: Unhandled promise rejection 
  (rejection id: 1): UnsupportedOperationError: Error 404: Not Found                                                                                                    
  Not Found                                                                                                               
  (node:5412) [DEP0018] DeprecationWarning: Unhandled promise rejections are 
  deprecated. In the future, promise rejections that are not handled will 
  terminate the Node.js process with a non-zero exit code. 
  </code></pre>
  
  <p>The Title: [object Promise] line executes before it can finish getting the title from the website. </p>
  
  <p>Thanks</p>