How to use the executablePath function from puppeteer

Find comprehensive JavaScript puppeteer.executablePath code examples handpicked from public code repositorys.

51
52
53
54
55
56
57
58
59
60
61
62
63


const domain = '@domain.net'
let email, username, password


puppeteer.launch({
    headless: false, executablePath: executablePath()
}).then(async browser => {


    username = 'username1234' + Math.floor(Math.random() * 100)
    email = username + domain
fork icon2
star icon7
watch icon0

23
24
25
26
27
28
29
30
31
32
try {
    const puppeteer = require('puppeteer-extra');
    const StealthPlugin = require('puppeteer-extra-plugin-stealth');
    puppeteer.use(StealthPlugin());
    const { executablePath } = require('puppeteer');
    const browser = yield puppeteer.launch({ headless: true, executablePath: executablePath() });
    const page = yield browser.newPage();
    yield page.setUserAgent('Mozilla/5.0 (iPhone; CPU iPhone OS 13_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/110.0.0.0 Mobile/15E148 Safari/604.1');
    yield page.goto(url, { waitUntil: 'networkidle2' }); // waits until page is fully loaded
    yield delay(1000, 2000); // emulates human behavior
fork icon0
star icon1
watch icon1

+ 19 other calls in file

63
64
65
66
67
68
69
70
71
72
        '--disable-popup-blocking',

        //'--proxy-server= http://127.0.0.1:8080 '// configure agent
    ],
    // executablePath   : findChrome(),
    executablePath: executablePath()
})

try {
    return await fn(browser)
fork icon0
star icon0
watch icon1

+ 6 other calls in file

11
12
13
14
15
16
17
18
19
20
21
let browser;
async function init() {
    if (process.env.EXECUTABLE_PATH) {
        browser = await puppeteer.launch({headless: true, executablePath: process.env.EXECUTABLE_PATH, args:['--no-sandbox']});
    } else {
        browser = await puppeteer.launch({headless: true, executablePath: executablePath()});
    }
}


async function stop() {
fork icon0
star icon0
watch icon1

+ 7 other calls in file

0
1
2
3
4
5
6
7
8
9
10
11
const puppeteer = require('puppeteer');
const path = require('path');


const getPage = async (styleId) => {
    if (globalThis[styleId + "page"] === undefined) {
        const options = typeof process.pkg !== 'undefined' ? { executablePath: puppeteer.executablePath().replace(/^.*?\\node_modules\\puppeteer\\\.local-chromium/, path.join(path.dirname(process.execPath), '.local-chromium')) } : {};
        const browser = await puppeteer.launch(options);


        const page = await browser.newPage();

fork icon0
star icon0
watch icon1

+ 14 other calls in file

-4
fork icon0
star icon0
watch icon1

+ 27 other calls in file

1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
        args: param
    });
} else {

    browser = await puppeteer.launch({
        executablePath: executablePath(),
        headless: headless_mode,
        devtools: false,
        userDataDir: `${profile_dir}`,
        args: param
fork icon0
star icon0
watch icon1

+ 10 other calls in file

32
33
34
35
36
37
38
39
40
        "--no-sandbox",
        "--single-process",
        "--no-zygote",
    ],
    executablePath : process.env.NODE_ENV === "production" ? 
        process.env.PUPPETEER_EXECUTABLE_PATH : puppeteer.executablePath()
})
page = await browser.newPage()
await page.goto("https://powerschool.hermitage.k12.pa.us")
fork icon0
star icon0
watch icon1

+ 15 other calls in file

127
128
129
130
131
132
133
134
135
136
    "--start-maximized",
  ],
  env: {
    LANG: "en",
  },
  // executablePath: executablePath(),
  executablePath: "C:/Program Files/Google/Chrome/Application/Chrome.exe",
};
// if (existsSync("/usr/bin/chromium-browser")) {
//   console.log("Altering puppeteer chromium path...");
fork icon0
star icon0
watch icon1

+ 29 other calls in file