问题
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