Ask Your Question
4

How can I use Puppeteer with an existing installation of Chrome on MacOS?

asked 2023-01-09 11:00:00 +0000

lalupa gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2022-11-29 20:00:00 +0000

huitzilopochtli gravatar image

To use Puppeteer with an existing installation of Chrome on MacOS, you can follow these steps:

  1. Install Puppeteer by running the command npm install puppeteer in your terminal.

  2. Verify that Puppeteer has downloaded the correct version of Chromium by running node -e 'console.log(require("puppeteer/package.json").puppeteer.chromium_revision)'

  3. Locate the Chrome executable file on your MacOS system. This can typically be found in the Applications folder. Copy the path to the executable file.

  4. Launch Puppeteer by passing the path to the Chrome executable file as a custom argument when creating a new Puppeteer instance.

    const puppeteer = require('puppeteer');
    
    (async () => {
    const browser = await puppeteer.launch({
      executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
    });
    const page = await browser.newPage();
    await page.goto('https://www.google.com');
    // Other Puppeteer code here
    await browser.close();
    })();
    
  5. You can then use Puppeteer with your existing installation of Chrome on MacOS, and any configurations or extensions that you have installed should be available.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-01-09 11:00:00 +0000

Seen: 12 times

Last updated: Nov 29 '22