Warm tip: This article is reproduced from serverfault.com, please click

puppeteer

发布于 2017-10-27 01:51:22

I was able to successfully download a file with puppeteer, but it was just saving it to my /Downloads folder. I've been looking around and can't find anything in the api or forums to set this location.

My downloads are basically just go going to the link:

await page.goto(url);
Questioner
A. L
Viewed
0
Md. Abu Taher 2017-11-15 00:51:35

This is how you can set the download path in latest puppeteer v0.13.

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

The behaviour is experimental, it might be removed, modified, or changed later.

Pst, you can try more tricks listed here, on your own risk :).