Last active
May 19, 2018 19:09
-
-
Save OliPassey/0d8d7916fdcfa0ec942e32ca60706f60 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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