
addFile() method to add it to the zip variable.
As each screenshot is logged with puppeteer, use the. Remove / make sure there is no the path attribute from the screenshot code block. I was able to get this to work, with the only remaining issue being a timeout 503 error when the app is deployed, but that's a different issue that I think should be ignored for the intent of this specific question (has to do with the length of time it takes for puppeteer to run all of the actions it needs to run causing a timeout on heroku, but this is still a working app in a local setting).Īt a high level, here are the important parts to getting this to work (will include code at the bottom): The standard approach for puppeteer screenshots seems to be to designate a local path for the images to live, but I've realized this creates security and privacy issues (even if it will only be internally used), so I'm wondering if there's a good way to bundle the screenshots into a downloadable zip instead of having them go straight into someone's local file system. The optimal state would be for them to be able to use this without needing to do anything with the command line, and so the best approach for that that I've been able to come up with is to deploy it live (although I am open to alternative suggestions in case there are options I haven't considered). In lieu of direct advice, I would love maybe some tips on where and how to best search on this so I can better research it myself.Įxtra context: My goal here is to make an app that my designers can use to capture screenshots of prior work. zip file that a user can download? This would exist as a deployed web app and not as a command line tool. Here we generate a CSV file and have the browser download it await page.The Question: Is there is a good way to have puppeteer.js take screenshots and then, instead of designating a local path for them to go, bundle them into a.
Const puppeteer = require ( 'puppeteer' ) Ĭonst browser = await puppeteer.launch()