title: Unable to return value from async method
body: <p>I need to fetch some Network logs from some async javascript methods, 
  so I wrote below script and it returned the expected value when executed on browser console.</p>
  
  <pre><code>var str=null;
  async function ensureFooIsSet() {
      return new Promise(function (resolve, reject) {
          waitForFoo(resolve);
      });
  }
  
  async function waitForFoo(resolve) {
      HAR.triggerExport().then(harLog =&gt; {
          str=harLog;
          resolve();
      });
  };
  await ensureFooIsSet().then();
  str;
  </code></pre>
  
  <p>Now I have to get value returned by str variable in my java program, for that I have to run the above script using JavaScriptExecutor, for the str to return value in javaScriptExecutor I have to change the last line of code to <code>return str;</code></p>
  
  <p>Now I am getting error "Uncaught SyntaxError: await is only valid in async function"</p>