forked from unconv/gpt4v-browsing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
screenshot.js
39 lines (31 loc) · 837 Bytes
/
screenshot.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const puppeteer = require('puppeteer-extra');
const StealthPlugin = require('puppeteer-extra-plugin-stealth');
puppeteer.use(StealthPlugin());
const url = process.argv[2];
const timeout = 8000;
(async () => {
const browser = await puppeteer.launch( {
headless: "new",
} );
const page = await browser.newPage();
await page.setViewport( {
width: 1200,
height: 1200,
deviceScaleFactor: 1,
} );
setTimeout(async () => {
await page.screenshot( {
path: "screenshot.jpg",
fullPage: true,
} );
}, timeout-2000);
await page.goto( url, {
waitUntil: "networkidle0",
timeout: timeout,
} );
await page.screenshot( {
path: "screenshot.jpg",
fullPage: true,
} );
await browser.close();
})();