puppeteer-mass-screenshots
Prerequisites | Installation | Manual | InitOptions | StartOptions | FAQ
Puppeteer mass screenshots is a simple Puppeteer's plugin to create automatic screenshots for every new frame appears in the browser.
Why
Unlike the regular screenshots function supplied by Puppeteer, our plugin runs on Chrome's API and doesn't affect Puppeteer's run time.
So basically by using this plugin, you'll be able to create very fast screenshots, and it won't slow your run time
Prerequisites
In order to use this plugin:
- Puppeteer must be installed.
- Pupepteer's page object must be created.
Installation
To install the plugin to your project please use:
npm install puppeteer-mass-screenshots
You'll probably prefer to add it to your package.json file so you can use:
npm install --save-prod puppeteer-mass-screenshots
Manual
Once Puppeteer mass screenshots is installed, you can require it in your project:
const PuppeteerMassScreenshots = require('puppeteer-mass-screenshots');
In your constructor create:
const screenshots = new PuppeteerMassScreenshots();
After you have page object
await screenshots.init(page, screenshotsPath);
- page - Puppeteer page object (related to the browser).
- screenshotsPath - where to save the created images
To start the automatic screenshots:
await screenshots.start();
To stop the automatic screenshots:
await screenshots.stop();
Important - call screenshots.stop before browser is closed.
FAQ
Does it support Chrome in headless mode?
Yes, it does.
it supports Chrome in headless / headful mode.
Does it support redirections in pages?
Yes, it does.
This plugin is based on Chrome's API,
which isn't affected by page's redirections.
Does it use the window object?
No, it doesn't use the window object.
Can I run this plugin with my own page/browser objects?
Yes.
put the page object in the init function, and the plugin will use it.
Will it change my browser/page/window objects?
No, it won't.
We use Chrome's API only.
How can I use this plugin to record video of my headless Chrome?
Check out Puppeteer video recorder
It uses our plugin, to save screenshots,
And uses ffmpeg to convert these screenshots to a video
Other options to configure [ optional ]
init options - see our Init options page
start options - see our Start options page