Last active
August 12, 2018 17:22
-
-
Save miya0001/88bdbf54d26c30c7b3eebb6290c820ac 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
const puppeteer = require('puppeteer'); | |
async function sleep(delay) { | |
return new Promise(resolve => setTimeout(resolve, delay)); | |
} | |
(async () => { | |
const browser = await puppeteer.launch({ | |
disable-gpu: true, | |
args: ['--no-sandbox'] | |
}); | |
const page = await browser.newPage(); | |
await page.setViewport({width: 1280, height: 720, deviceScaleFactor: 2}); | |
await page.goto('https://styles.mapserver.jp/#5/35.69/139.69'); | |
await sleep(10000) | |
await page.screenshot({path: "test.png"}); | |
browser.close(); | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment