title: Selenium Protractor in Javascript: Extracting getText keeps returning undefined
body: <p>I have an element with inner text on my page I want to extract.</p>
  
  <p>So I do:</p>
  
  <pre><code>element(by.xpath('//*[@id="searchQuery"]')).getText().then(function (text){
      return text;
  });
  </code></pre>
  
  <p>but I always get an <code>undefined</code> return value. </p>
  
  <p>Is there another way of extracting text?</p>