How to download PDF file using PUPPETEER after form submit? NodeJS | PUPPETEER

Viewed 8224

I've been trying to download a PDF file using headless chrome. What I got to do is send a form with some info, on form submit it should download a PDF. How do I save this PDF? Obs: I'm using NodeJS as the framework.

1 Answers

I do not know exactly how the pdf is downloaded but I think you can use the following.

await page._client.send('Page.setDownloadBehavior', {behavior: 'allow', downloadPath: '/home/me/stuff'});

And then check for the file to be in the directory specified in the downloadPath property.

Related