KunLun
KunLun

Reputation: 3225

Selenium ChromeDriver load extension problem with path

I'm trying to load an extension into ChromeDriver like this:

ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--load-extension=file:/path/extension");

driver = new ChromeDriver(chromeOptions);

But I get an error:

Failed to load extension from:

C:\Program Files\Google\Chrome\Application\69...\file:\path\extension.

Manifest file is missing or unreadable

How to make ChromeDriver to load extension exactly from where I tell him.

Upvotes: 0

Views: 1561

Answers (1)

Infern0
Infern0

Reputation: 2814

Try with the following, from this site:

ChromeOptions options = new ChromeOptions();
options.addExtensions(new File("/path/to/extension.crx"));
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
ChromeDriver driver = new ChromeDriver(capabilities);

Upvotes: 2

Related Questions