Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load extensions on Windows #2733

Closed
ssut opened this issue Jun 14, 2018 · 10 comments
Closed

Load extensions on Windows #2733

ssut opened this issue Jun 14, 2018 · 10 comments

Comments

@ssut
Copy link

ssut commented Jun 14, 2018

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: 1.5.0
  • Platform / OS version: Windows 10
  • URLs (if applicable):
  • Node.js version: 9

What steps will reproduce the problem?

Please include code that reproduces the issue.

I needed to load a extension that a page requires, so I added --disable-extensions-except and --load-extension args but it doesn't load on windows. The full args I passed were:

[ '--enable-logging',
  '--v=1',
  'about:blank',
  '--disable-extensions-except="C:\\Users\\...\\chrome-extensions"',
  '--load-extension="C:\\Users\\...\\chrome-extensions"' ]

And the result was:

---------------------------
Error Loading Extension
---------------------------
Failed to load extension from:
C:\Users\...\...\...\node_modules\puppeteer\.local-chromium\win64-564778\chrome-win32\"C:\Users\...\chrome-extensions". Manifest file is missing or unreadable.
---------------------------
OK
---------------------------

What is the expected result?

Load extensions properly.

What happens instead?

---------------------------
Error Loading Extension
---------------------------
Failed to load extension from:
C:\Users\...\...\...\node_modules\puppeteer\.local-chromium\win64-564778\chrome-win32\"C:\Users\...\chrome-extensions". Manifest file is missing or unreadable.
---------------------------
OK
---------------------------

I think if I pass the extension path as a relative path it might be work but I also think that is so awful.

@ssut
Copy link
Author

ssut commented Jun 15, 2018

I temporary solved this issue by removing --disable-extensions from the default arguments.

@aslushnikov
Copy link
Contributor

I temporary solved this issue by removing --disable-extensions from the default arguments.

This is the way to go for now; we might do a nicer extensions support eventually.

@mayank2567
Copy link

I temporary solved this issue by removing --disable-extensions from the default arguments.

but then it does not load any extentions

@xxclodxx
Copy link

I am also unable to load my extension, I am following the same commands but instead of puppeteer I am using puppeteer-core, I do get the error saying that loading extensions is disabled by admin and the extension will not any thoughts?

@sergtimosh
Copy link

Same issue with loading extension with puppeteer on windows.
Works fine on mac, though.

@Ajju2211
Copy link

Getting. Manifest file missing while loading extensions.I downloaded crx file of the extension then I converted it to zip file then its relative path added. Whats wrong?

@mercertom
Copy link

mercertom commented Jun 5, 2020

I finally fixed this exact error/issue with ublock. I had originally made several errors. It now works.

  1. I had a typo in my datadir declaration
  2. ublock has nested directories with weird names (I'm not sure this mattered)

Here's the working code:

	const ublock = '~/Documents/jsprojects/puppeteer-extensions/ublock/';
	const datadir = '~/Documents/jsprojects/chromeprofile/';
	const browser = await puppeteer.launch({
		headless: false,
		userDataDir: datadir,
		defaultViewport: { width:1000, height: 1080 },
		args:
		[
		`--disable-extensions-except=${ublock}`,
		`--load-extension=${ublock}`,
	});

In /puppeteer-extensions/, I changed /chromium.ublock0.152341/ or whatever to plain /ublock/, and deleted a nested sub-directory with an equally funky name. Within /ublock/ there is a manifest.json. Many extensions have multiple layers of weird-named directories. Change the dir names to something simple like /ublock/, and then make sure your line declaring the extension has that directory path typed perfectly in your code.

@Ajju2211 I think you should unzip the extension and absolute/relative path to the directory that contains manifest.json.

@Luckz
Copy link

Luckz commented Oct 8, 2022

How about having a Chrome Web Store (CWS) extension installed and just having that not removed and not disabled and such?

@danielehrhardt
Copy link

export const extensions = [
  path.join(process.cwd(), 'plugins', 'cookies'),
  path.join(process.cwd(), 'plugins', 'ublock-origin'),
];

@dgtlmoon
Copy link

@danielehrhardt how did you come up with that JS? where did you find it works? can you give any more information? what version etc?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants