Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to load Chrome in Puppeteer on Mac?

Why can I not load Chrome in the browser? I get error:

The message is Failed to launch the browser process! spawn /Applications/GoogleChrome.app ENOENT TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md

Node version v13.12.0

 const browser = await puppeteer.launch({executablePath:'/Applications/Google\Chrome.app'});
 const page = await browser.newPage();
 await page.goto('https://my.gumtree.com/login', {waitUntil: 'networkidle2'});
 const myButton = await page.$('#google-sign-in-button');
 myButton.click();

enter image description here

like image 788
bibscy Avatar asked Oct 26 '25 02:10

bibscy


1 Answers

If you want to launch puppeteer with already installed chronium, you need to set executablePath. So please check the exact path of chronium.

  1. browse chrome://version/ in your chrome.
  2. then, you can find executablePath.
  3. Make sure you wrote the correct path.

const browser = await puppeteer.launch({executablePath:'your executable Path'});
const page = await browser.newPage();
await page.goto('https://my.gumtree.com/login', {waitUntil: 'networkidle2'});
const myButton = await page.$('#google-sign-in-button');
myButton.click();
like image 76
hadoobidoop Avatar answered Oct 28 '25 04:10

hadoobidoop