Created
June 3, 2018 12:19
-
-
Save akagisho/d6ab6ec8253c7a152507e8cbce10c99e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const viewportWidth = 1200; | |
const viewportHeight = 900; | |
const argv = process.argv; | |
var path = require('path'); | |
const puppeteer = require('puppeteer'); | |
if (argv.length < 3) { | |
console.error('Usage: node ' + path.basename(argv[1]) + ' <path> <url>'); | |
process.exit(1); | |
} | |
(async () => { | |
const browser = await puppeteer.launch(); | |
const page = await browser.newPage(); | |
page.setViewport({width: viewportWidth, height: viewportHeight}); | |
await page.goto(argv[3]); | |
page.evaluate(_ => { | |
window.scrollBy(0, window.innerHeight); | |
}); | |
await page.screenshot({ | |
path: argv[2], | |
fullPage: true | |
}); | |
await browser.close(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment