title: Exposed function querySelector not working in Puppeteer
body: <pre><code>document.querySelectorAll('.summary').innerText;
  </code></pre>
  <p>This throws an error in the below snippet saying &quot;document.querySelector is not a function&quot; in my Puppeteer page's exposed fucntion <code>docTest</code>.</p>
  <p>I want to pass a specific node to each method and get the result inside <code>evaluate</code>.</p>
  <p>Same with <code>document.getElemenetbyId</code>.</p>
  <pre><code>const puppeteer = require('puppeteer');
  //var querySelectorAll = require('query-selector');
  
  
  let docTest = (document) =&gt; {
  var summary = document.querySelectorAll(.summary).innerText;
  console.log(summary);
  return summary;
  }
  
  let scrape = async () =&gt; {
  
  const browser = await puppeteer.launch({
      headless: false
  });
  const page = await browser.newPage();
  
  await page.goto('http://localhost.com:80/static.html');
  await page.waitFor(5000)
  await page.exposeFunction('docTest', docTest);
  
  var result = await page.evaluate(() =&gt; {
      var resultworking = document.querySelector(&quot;tr&quot;);
      console.log(resultworking);
      var summary  = docTest(document);
      console.log(resultworking);
      return summary;
  
  });
  console.log(result);
  
  await page.waitFor(7000);
  browser.close();
  return {
      result
  }
  };
  
  scrape().then((value) =&gt; {
  console.log(value); // Success!
  });
  </code></pre>