Skip to content

Instantly share code, notes, and snippets.

@miya0001
Last active August 12, 2018 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miya0001/88bdbf54d26c30c7b3eebb6290c820ac to your computer and use it in GitHub Desktop.
Save miya0001/88bdbf54d26c30c7b3eebb6290c820ac to your computer and use it in GitHub Desktop.
スクリーンショットをとる
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