title: JS Puppeteer wait for page load to complete
body: <p>After seeing this <a href="https://www.youtube.com/watch?v=pixfH6yyqZk&amp;t=2075s" rel="nofollow noreferrer">youtube video using puppeteer</a> I got inspired to play a bit around with it. But I seem to have made the wrong choice of a website as a starter project.</p>
  
  <pre><code>const puppeteer = require('puppeteer')
  ;(async () =&gt; {
    const browser = await puppeteer.launch()
    const page = await browser.newPage()
  
    await page.goto('http://www.produktresume.dk/AppBuilder/search?page=0')
    page.once('load', () =&gt; {
      const drugs = page
        .evaluate(() =&gt;
          [...document.querySelectorAll('div.entity-link')].map(item =&gt; item)
        )
        .catch(err =&gt; console.log(err))
      console.log(drugs[0])
    })
  
    await browser.close()
  })()
  </code></pre>
  
  <p>I have googled around and lost track of the different things I have tried.. </p>
  
  <p>My perception of my problem is that I don't call the evaluate at the right time - when the page is loaded.</p>