title: How can I use jQuery with Puppeteer?
body: <p>So, I am using Puppeteer (a headless browser) to scrape through a website, and when I access that url, how can I load jQuery to use it inside my page.evaluate() function.</p>
  <p>All I have now is a .js file and I'm running the code below. It goes to my URL as intended until I get an error on page.evaluate() since it seems like it's not loading the jQuery as I thought it would from the code on line 7: <code>await page.addScriptTag({url: 'https://code.jquery.com/jquery-3.2.1.min.js'}) </code></p>
  <p>Any ideas how I can load jQuery correctly here, so that I can use jQuery inside my page.evaluate() function?</p>
  <pre><code>(async() =&gt; {
    let url = &quot;[website url I'm scraping]&quot;
    let browser = await puppeteer.launch({headless:false});
    let page = await browser.newPage();
    await page.goto(url, {waitUntil: 'networkidle2'});
    // code below doesn't seem to load jQuery, since I get an error in page.evaluate()
    await page.addScriptTag({url: 'https://code.jquery.com/jquery-3.2.1.min.js'})
    await page.evaluate( () =&gt; {
        // want to use jQuery here to do access DOM
        var classes = $( &quot;td:contains('Lec')&quot;)
        classes = classes.not('.Comments')
        classes = classes.not('.Pct100')
        classes = Array.from(classes)
    });
  })();
  </code></pre>