Skip to content

Instantly share code, notes, and snippets.

@t-okushima
Last active June 22, 2017 14:53
Show Gist options
  • Save t-okushima/5f20ae18fa4953949caef0f5cd2fe8a2 to your computer and use it in GitHub Desktop.
Save t-okushima/5f20ae18fa4953949caef0f5cd2fe8a2 to your computer and use it in GitHub Desktop.
nightmareでScreenshotを撮る ref: http://qiita.com/t-okushima/items/156ff195a7bb9b38c137
'use strict';
const Nightmare = require('nightmare');
const nightmare = new Nightmare();
// showにtrueをセットすると可視化されます。
// const nightmare = new Nightmare({show:true});
main();
async function main() {
await screenshot('https://www.google.co.jp');
}
async function screenshot(url) {
await nightmare
.goto(url)
.viewport(1024, 768)
.screenshot('screenshot.png')
.end();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment