Skip to content

Instantly share code, notes, and snippets.

@OliPassey
Last active May 19, 2018 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OliPassey/0d8d7916fdcfa0ec942e32ca60706f60 to your computer and use it in GitHub Desktop.
Save OliPassey/0d8d7916fdcfa0ec942e32ca60706f60 to your computer and use it in GitHub Desktop.
var CronJob = require('cron').CronJob;
var job = new CronJob({
cronTime: '00 */5 * * * *',
onTick: function() {
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setViewport({width: 1920, height: 1080});
await page.goto('YOUR-URL-HERE', {waitUntil: 'networkidle0', timeout: 10000});
await page.screenshot({path: 'c:/folder/file.png'});
await browser.close();
})();
},
start: false,
timeZone: 'Europe/London'
});
job.start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment