Ad

Is There A Way To Take A Screenshot Of Every Page On A Website?

We have a couple of legacy sites undergoing an upgrade. It would be useful to be able to screenshot every page and then md5 sum the results for both domains, and then test if everything which renders matches 100%.

I am unsure of how to do this - we have looked at cheerio which would crawl the site but be unable to screenshot, and nightwatch which can take screenshots but not crawl the site. Does anyone have experience doing this?

Ad

Answer

An easy solution is to use Chrome in headless mode which can also be controlled with many Node modules like Puppeteer.

Taken from the Google Developers page:

chrome --headless --disable-gpu --screenshot https://www.chromestatus.com/

About crawling, you can use a mix of Cheerio and Puppeteer to crawl links and take screenshots. Alternatively you could find some tool that allows to export a sitemap (example) with all the website URLs, at this point it should be easy to loop through them and take a screenshot of each.

Ad
source: stackoverflow.com
Ad