-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlaunch.js
34 lines (33 loc) · 1.1 KB
/
launch.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
const puppeteer = require("puppeteer-extra");
const StealthPlugin = require("puppeteer-extra-plugin-stealth");
module.exports = async () => {
try {
const options = {
executablePath:
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
headless: false,
devtools: false,
ignoreHTTPSErrors: true,
args: [
"--start-maximized",
"--no-sandbox",
"--disable-setuid-sandbox",
"--ignore-certificate-errors",
],
ignoreDefaultArgs: ["--enable-automation"],
slowMo: 10,
};
await puppeteer.use(StealthPlugin());
const browser = await puppeteer.launch(options);
let pagesCount = await browser.pages();
const browserWSEndpoint = await browser.wsEndpoint();
// console WSEndPoint say : "ws://127.0.0.1:42207/devtools/browser/dbb2525b-ce44-43c2-a335-ff15d0306f36"
console.log("browserWSEndpoint----- :> ", browserWSEndpoint);
await browser.disconnect();
return browserWSEndpoint;
} catch (err) {
console.error(err);
process.exit(1);
return false;
}
};