Puppeteer: How do I download a file using chrome headless browser api?

旧街凉风 提交于 2020-08-23 03:59:16

问题


Using Puppeteer, how do I get the headless chrome browser to download a file (or make additional http requests and save the response)?


回答1:


You could make a simple request through the window, it should work. npm request

As soon as it returns the promise with your response, you could write an express Save function, and store the response.

It seems that puppeteer it has this implementation. See here: How to make a request with puppeteer.

Have a look over this:

Emitted when a page issues a request. The request object is read-only. In order to intercept and mutate requests, see page.setRequestInterceptionEnabled.

I hope this helps.

Link for setting headers



来源:https://stackoverflow.com/questions/45720747/puppeteer-how-do-i-download-a-file-using-chrome-headless-browser-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!