title: Puppeteer wait until page is completely loaded
body: <p>I am working on creating PDF from web page.</p>
  
  <p>The application on which I am working is single page application.</p>
  
  <p>I tried many options and suggestion on <a href="https://github.com/GoogleChrome/puppeteer/issues/1412" rel="noreferrer">https://github.com/GoogleChrome/puppeteer/issues/1412</a></p>
  
  <p>But it is not working</p>
  
  <pre><code>    const browser = await puppeteer.launch({
      executablePath: 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe',
      ignoreHTTPSErrors: true,
      headless: true,
      devtools: false,
      args: ['--no-sandbox', '--disable-setuid-sandbox']
  });
  
  const page = await browser.newPage();
  
  await page.goto(fullUrl, {
      waitUntil: 'networkidle2'
  });
  
  await page.type('#username', 'scott');
  await page.type('#password', 'tiger');
  
  await page.click('#Login_Button');
  await page.waitFor(2000);
  
  await page.pdf({
      path: outputFileName,
      displayHeaderFooter: true,
      headerTemplate: '',
      footerTemplate: '',
      printBackground: true,
      format: 'A4'
  });
  </code></pre>
  
  <p>What I want is to generate PDF report as soon as Page is loaded completely.</p>
  
  <p>I don't want to write any type of delays i.e.   await page.waitFor(2000);</p>
  
  <p>I can not do waitForSelector because the page has charts and graphs which are rendered after calculations.</p>
  
  <p>Help will be appreciated.</p>