Search code examples
javascriptgoogle-chromegoogle-chrome-extensionpuppeteer

Can't use chrome extensions when puppeteer open the chrome


extensions pics The extensions menu can't use when I used the puppeteer open the chrome or chromium.

const browser = await puppeteer.launch({
'executablePath': executablePath,
// 'ignoreDefaultArgs': ['--enable-automation'],
'args': ['--start-maximized', '--enable-automation', '--enable-remote-extensions'],
'devtools': true,
'headless': false,
'defaultViewport': null,
'userDataDir': `${userDataDir}${storeSession.store_name}${storeSession.id}`
})

what should I do?

chromium Version 79.0.3937.0 (Developer Build) (64-bit)

chrome 77.0.3865.120

puppeteer 1.19.0


Solution

  • See the Github thread on this. You'll need to add the following:

      args: [
        '--disable-extensions-except=/path/to/extension/',
        '--load-extension=/path/to/extension/',
      ]
    

    Use the official Puppeteer documentation for more help.