'Puppeteer --load-extension does not actually install the extension

I have a Chrome Extension I want to install automatically on a Chrome Profile stored at my Desktop.

Chrome Profile Path: C:\\Users\\user\\Desktop\\ChromeProfiles\\test

Chrome Extension Path: C:\\Users\\user\\Desktop\\SSDC Bot Chrome Console\\Extension Ver

I use this code below to launch a Chrome and load in the Extension:

(async () => {
    const pathToExtension = require('path').join("C:\\Users\\user\\Desktop\\SSDC Bot Chrome Console", 'Extension Ver');
    const browser = await puppeteer.launch({
      headless: false,
      args: [
        `--disable-extensions-except=${pathToExtension}`,
        `--load-extension=${pathToExtension}`,
        `--user-data-dir=${'C:\\Users\\user\\Desktop\\ChromeProfiles'+'\\'+'test'}`
      ],
      executablePath : arg[0]
    });
  })();

What I want to achieve is the following:

  1. Open that Chrome Profile using Puppeteer and Install Extension
  2. Open that Chrome Profile using CMD (Not controlled by puppeteer) and have the Chrome Extension be present.

However, after successfully running the code above and Chrome launches controlled by Puppeteer and having the chrome extension there, when I launch the profile using CMD, the extension is gone.

Should I be using --load-extension? Is there a different flag to use or way to install the extension?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source