I know this should be simple. But how do return the values for use outside the function, I cannot get it to work. This works downloading file and in the console returns
value: attachment; filename="filename"
await page._client.send('Page.setDownloadBehavior', {behavior: 'allow', downloadPath: './tmp'})
await page.click('download');
await page.on('response', resp => {
var header = resp.headers();
console.log("value: " + header['content-disposition']);
});
but this and everything I have tried returns nothing
await page.on('response', resp => {
var header = resp.headers();
return header['content-disposition'];
});
I want to be able to return the filename, file size, etc. of a downloaded file for further use in the script.
How do I return and access the response values?