title: Giving timeout after evaluate in puppeteer is not working
body: <p>I have a page which contains few visualizations. I have to evaluate and resize the charts. while evaluating, it takes few seconds to resize. the Previously I did this using phantom. I use to give timeout in the callback function and it worked perfectly. I'm trying the same using puppeteer which is not working. Not working in the sense, the resizing did not happen even after the timeout. </p>
  
  <p><strong>sample puppeteer code(not working)</strong></p>
  
  <pre><code>const puppeteer = require('puppeteer');
  const fs = require('fs');
  
  function timeout(ms) {
      return new Promise(resolve =&gt; setTimeout(resolve, ms));
  }
  (async() =&gt; {
      const browser = await puppeteer.launch();
      const page = await browser.newPage();
      await page.setViewport({ width: 2048, height: 1024 });
  
  
      await page.goto("http://localhost:3000", { timeout: 180000 });
  
      await timeout(5000);
      page.on('console', msg =&gt; console.log('PAGE LOG:', msg.text()));
      await page.evaluate(function() {
              for (var i = 0; i &lt; $('.react-grid-item').length; i++) {
                  $('.react-grid-item:eq(' + i + ')').css({
                      position: 'absolute',
                      height: '300px',
                      width: '100%',
                      top: (i * 300) + 'px',
                      left: '0px'
                  })
              }
          })
          .then(function() {
              setTimeout(function() {
                  page.pdf({
                      path: 'test' + new Date() + '.pdf',
                      // height: 7777,
                      // width: 2048,
                      format: 'a4',
                      displayHeaderFooter: false,
                      margin: {
                          top: "75px",
                          bottom: "75px"
                      }
                  });
                  // console.log(sum);
              }, 5000);
          }).catch(function(err) {
              console.error(err);
          })
  
  })();
  </code></pre>