add mac browser path

main
Ibraheem Saleh 10 months ago
parent d9839f21ea
commit 1458f3071c

@ -9,7 +9,9 @@ import AdblockerPlugin from 'puppeteer-extra-plugin-adblocker';
import fs from 'fs'; import fs from 'fs';
const url = 'https://www.bestbuy.com/gateway/graphql'; const url = 'https://www.bestbuy.com/gateway/graphql';
// toggle browser for platform.
const browser_path = 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe'; const browser_path = 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe';
//const browser_path = '/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome';
puppeteer.use(StealthPlugin()); puppeteer.use(StealthPlugin());
puppeteer.use(AnonymizeUAPlugin()); puppeteer.use(AnonymizeUAPlugin());

@ -12,6 +12,9 @@ puppeteer.use(
} }
)); ));
// Toggle browser for platform
const browser_path = "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe";
//const browser_path = '/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome';
const browser = await puppeteer.launch({ const browser = await puppeteer.launch({
headless: false, headless: false,
@ -19,7 +22,7 @@ const browser = await puppeteer.launch({
ignoreDefaultArgs: ["--disable-extensions"], ignoreDefaultArgs: ["--disable-extensions"],
dumpio: true, dumpio: true,
args: ["--start-maximized", "--no-sandbox", "--disable-setuid-sandbox"], args: ["--start-maximized", "--no-sandbox", "--disable-setuid-sandbox"],
executablePath: "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe", executablePath: browser_path,
}); });
const page = await browser.newPage(); const page = await browser.newPage();
@ -61,4 +64,4 @@ return json;
fs.writeFileSync('./localStorage.json', JSON.stringify(localStorageData, null, 2)); fs.writeFileSync('./localStorage.json', JSON.stringify(localStorageData, null, 2));
console.log('Login session saved.'); console.log('Login session saved.');
await browser.close(); await browser.close();

Loading…
Cancel
Save