title: How to wait for all downloads to complete with Puppeteer?
body: <p>I have a small web scraping application that downloads multiple files from a web application where the URLs require visting the page.</p>
  <p>It works fine if I keep the browser instance alive in between runs, but I want to close the instance in between runs. When I call <code>browser.close()</code> my downloads are stopped because the chrome instance is closed before the downloads have finished.</p>
  <p>Does puppeteer provide a way to check if downloads are still active, and wait for them to complete? I've tried <code>page.waitForNavigation({ waitUntil: &quot;networkidle0&quot; })</code> and <code>&quot;networkidle2&quot;</code>, but those seem to wait indefinitely.</p>
  <hr />
  <ul>
  <li>node.js 8.10</li>
  <li>puppeteer 1.10.0</li>
  </ul>