blob: 0db29a6d1ff32134f7537c1364ee07da4f2d11b1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
const path = require('path');
const puppeteer = require('puppeteer-core');
async function main() {
const browser = await puppeteer.launch({
executablePath: 'google-chrome-stable',
args: ['--no-sandbox'],
})
const page = await browser.newPage();
await page.setViewport({
width: 600,
height: 800
});
await page.goto(`http://localhost:8080`, { waitUntil: 'networkidle0' });
await page.waitFor(2000);
await page.screenshot({path: 'screenshot/color.png'});
await browser.close();
}
main().then(console.log).catch(console.error)
|