Q:

How to wait for all downloads to complete with Puppeteer?

node.js 8.10
puppeteer 1.10.0
I have a small web scraping application that downloads multiple files from a Java Server Faces based web application. The downloads are triggered by clicking the link for each file. Unfortunately there is no direct url for the download and I have to do it this way. 
It works fine if I keep the browser instance alive in between runs. For stability reasons I want to close the instance in between runs though. 
When I call browser.close() my downloads are stopped because the chrome instance is closed before the downloads have finished. 
Does puppeteer provide a way to check if downloads are still active, and wait for them to complete? I've tried page.waitForNavigation({ waitUntil: "networkidle0" }) and "networkidle2", but those seem to wait indefinitely. 
Thanks!

A:

Tried doing an await page.waitFor(50000); with a time as long as the download should take.
Or look at watching for file changes on complete file transfer

