title: Puppeteer not executing forEach
body: <p>I have this code</p>
  
  <pre><code>  ...
    const page = await browser.newPage();
    page.on('console', msg =&gt; {
      if (msg._type === 'log') {
        console.log(msg._text);
      }
    });
    ...
  
    await page.evaluate(() =&gt; {
      document.querySelectorAll('.foo').forEach(bar =&gt; {
        console.log('This logs not');
        if (bar.querySelector('div &gt; p').innerHTML === 'foo bar') {
          bar.querySelector('.dropdown').click();
        }
      });
    });
  </code></pre>
  
  <p>But its not logging anything. When I do</p>
  
  <pre><code>  await page.evaluate(() =&gt; {
      const test = document.querySelectorAll('.foo')
      console.log('This logs');
      test.forEach(bar =&gt; {
        console.log('This logs not');
        if (bar.querySelector('div &gt; p').innerHTML === 'foo bar') {
          bar.querySelector('.dropdown').click();
        }
      });
    });
  </code></pre>
  
  <p>It logs the first <code>console.log()</code>.
  Why isn#t it executing the <code>forEach</code>?</p>