forked from unconv/gpt4v-browsing
-
Notifications
You must be signed in to change notification settings - Fork 123
/
screenshot.js
36 lines (28 loc) · 925 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
const puppeteer = require('puppeteer-extra');
const StealthPlugin = require('puppeteer-extra-plugin-stealth');
puppeteer.use(StealthPlugin());
const url = process.argv[2];
const timeout = 5000;
(async () => {
const browser = await puppeteer.launch( {
headless: "false",
executablePath: '/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary',
userDataDir: '/Users/jasonzhou/Library/Application\ Support/Google/Chrome\ Canary/Default',
} );
const page = await browser.newPage();
await page.setViewport( {
width: 1200,
height: 1200,
deviceScaleFactor: 1,
} );
await page.goto( url, {
waitUntil: "domcontentloaded",
timeout: timeout,
} );
await page.waitForTimeout(timeout);
await page.screenshot({
path: "screenshot.jpg",
fullPage: true,
});
await browser.close();
})();