Last active
June 22, 2017 14:53
-
-
Save t-okushima/5f20ae18fa4953949caef0f5cd2fe8a2 to your computer and use it in GitHub Desktop.
nightmareでScreenshotを撮る ref: http://qiita.com/t-okushima/items/156ff195a7bb9b38c137
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
'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