Skip to content

A docker compose configuration that uses headless chrome with puppeteer to generate full page screenshots for a given set of urls and devices. An effective DIY solution to batch screenshot for proofing & testing devices.

License

Notifications You must be signed in to change notification settings

LuD1161/chrome-shots

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chrome Shots

A docker compose configuration that uses headless chrome with puppeteer to generate full page screenshots for a given set of urls and devices.

Usage

An effective DIY solution to batch screenshot for proofing & testing devices.
I use in combination with Invision.
Of course, it is useful for several different things.

Alt Text

Proofing Scenario

    1. Edit devices.js for each desired device to test and add desired test urls to url.js
    1. Create Invision prototype for each of those desired device configurations
    1. Run script*
    1. Upload device screenshot device folder to Invison prototype

Simply repeat steps 3-4 for each set of revisions

*The script is creating a puppeteer instance and goes through each configured device to update the viewport. For each of these configurations the url list will be used to create full page screenshots, which will be stored in the screenshots directory that will be created/updated under app each time the script is ran.


Prerequisites

Install Docker & Running

Install Docker and make sure it is up and running before moving ahead.
Should be able to access docker commands in cli.

Configure devices and urls

A preconfigured list of devices is available in the applications devices.js.
The list was extracted from the Chromium repository: Chromium Emulated Device Configurations Json

In the urls.js is the list of pages that will be requested to create screenshots.

Helpful Tools

  • To easily collect a list of urls- use this tool SEO Chat Website Crawler, download the xls file, then add desired urls to urls.js
  • See puppeteer docs for more options on device viewports, configuration, loading options, etc.

Execution

Build the puppeteer container

This is required only once in order to create the Docker image.

docker-compose build

Generate screenshots

Must be run each time to generate all screenshots for the devices and urls. The container will be exited once the job is done.

docker-compose run puppeteer

Credit


  • @nezhar for putting this together
  • @schnerd for the full page screenshot fix

About

A docker compose configuration that uses headless chrome with puppeteer to generate full page screenshots for a given set of urls and devices. An effective DIY solution to batch screenshot for proofing & testing devices.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 85.3%
  • Dockerfile 14.7%