3

(I'm new so don't kill me, please)

I'm trying to start ChromeDriver for a Chromium-based browser with multiple unpacked extensions, thus (simplified for your convenience, but basically the same as in the code):

   foreach (var path in ExtensionsPaths)
   {
    CommonWebDriver._ChromeOptionsForTorch.AddArguments(new string[1] { "--load-extension=" + path });
   }

After the foreach finishes running, I see all the extensions I want to load listed in the options.

When I create the ChromeDriver, though, it only loads one extension from this list - the last one of them.

What am I doing wrong? Is it possible to load multiple extensions?

Bell
  • 31
  • 2
  • 2
    I love the reputation Stackoverflow has gotten :P seen so clearly here. Welcome, as long as you read how to post a question I'm pretty sure no one will try to kill you :P – Callum Linington Aug 01 '16 at 08:42
  • 1
    Thanks! Right now I'm hiding under my desk, sword in hand. Just in case, you know. :-) – Bell Aug 01 '16 at 08:45

2 Answers2

1

You could try:

ChromeOptions options = new ChromeOptions();

foreach (var path in ExtensionsPaths)
{
    options.AddExtensions(new File(path));
}
Josh
  • 697
  • 7
  • 16
0

You provide one argument string containing multiple paths to extensions separated by comma:

ChromeOptions options = new ChromeOptions();
options.AddArgument(@"load-extension=c:\PathToFirstExtensionHere,c:\PathToSecondExtensionHere");
Driver = new ChromeDriver(options);
DrMad
  • 1
  • In my case this does not work for extensions packed by zip. But using ChromeOptions.AddExtensions in cycle work fine. chromedriver 78.0.3904.10500. – DanilaNV Nov 28 '19 at 12:08