| #!/usr/bin/env node |
| |
| const puppeteer = require('puppeteer'); |
| |
| function delay(time) { |
| return new Promise(function (resolve) { |
| setTimeout(resolve, time) |
| }); |
| } |
| |
| (async () => { |
| const browser = await puppeteer.launch({ |
| headless: "new", |
| args: ['--no-sandbox'], |
| defaultViewport: { |
| width: 1024, |
| height: 600, |
| isLandscape: true, |
| deviceScaleFactor: 1 |
| } |
| }); |
| |
| const page = await browser.newPage(); |
| |
| for (var i = 2; i < process.argv.length; i += 2) { |
| await page.goto(process.argv[i], { waitUntil: 'networkidle2' }); |
| await delay(1000); |
| await page.screenshot({ path: process.argv[i+1] }); |
| } |
| |
| await browser.close(); |
| })(); |