So I'm trying to download a pdf file that opens in a pop up, like this.
Using this code right here to get the pop up and download it to './'.
const popUp = await popUpPromise
await popUp.waitFor(5000)
// await popUp.waitForSelector('.content')
const pdf = await popUp.$$eval('html', e => e)
await console.log(pdf)
await popUp._client.send('Page.setDownloadBehavior', {behavior: 'allow', downloadPath: './'})
But not only it isn't downloading as I expected, but the html from the pop up is returning empty.
In order to download a pdf from a popup you will need to simulate pressing ctrl-s once the popup loads. It should download to your specified folder in your downloadbehavior settings. Try using await page.type()
or await page.press()