diff options
Diffstat (limited to 'magiccapture/index.js')
| -rw-r--r-- | magiccapture/index.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/magiccapture/index.js b/magiccapture/index.js new file mode 100644 index 0000000..0db29a6 --- /dev/null +++ b/magiccapture/index.js @@ -0,0 +1,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) |
