This ticket is related to ticket 1578 for Selenium , but my issue is with Chrome and not Firefox as in that ticket.
Installing and configuring an extension works when using a local driver. Doing the same using the C# implementation of RemoteWebDriver does not. Tested this with Chrome.
In my test case, the remote execution was done against SauceLabs. Contacted their support and they verified that installing extensions via RemoteWebDriver works in the JAVA implementation, but fails using the C# implementation.
To quote from their support ticket:
"I tried this myself and I was running into issues on my own end, so this may be a flaw with the C# Selenium bindings with RemoteWebDriver."
My code:
private IWebDriver GetSauceLabsDriver(){
var outPutDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
ChromeOptions options = new ChromeOptions();
options.AddExtensions(outPutDirectory + @"\3.1.3_0.crx");
//DesiredCapabilities caps = (DesiredCapabilities)options.ToCapabilities();
var caps = new DesiredCapabilities();
caps.SetCapability(ChromeOptions.Capability, options.Extensions[0]);
caps.SetCapability(CapabilityType.BrowserName, "chrome");
caps.SetCapability(CapabilityType.Version, "53.0");
caps.SetCapability(CapabilityType.Platform, "Windows 10");
caps.SetCapability("deviceName", "");
caps.SetCapability("deviceOrientation", "");
caps.SetCapability("username", "kin");
caps.SetCapability("accessKey", "9cd6-438e-a9635b70953d");
caps.SetCapability("name", TestContext.CurrentContext.Test.Name);
return new RemoteWebDriver(new Uri("http://ondemand.saucelabs.com:80/wd/hub"), caps,
TimeSpan.FromSeconds(600));
}