Skip to content
Advertisement

How to fix the TypeError ‘Cannot read property ‘download’ of undefined’ from browser.downloads.download using Puppeteer

I am using puppeteer to login into my account of a content provider I work with and download a lot of zips. I can easily get the array with all the links I need to download then I loop through the array and use browser.downloads.download (code taken from MDN) to download each link. The problem is that even before it starts to download it tells me:

JavaScript

Here is my code:

JavaScript

It somehow tells me the browser is undefined, but it is JS API.

Advertisement

Answer

There is no this method or property downloads in Browse object, you can check it here on puppeteer docs.

you can try using a http request to get your files, for example using this strategy below, I couldn’t try it, but I hope it is usefull for you =)

JavaScript
Advertisement