The Problem

If you are attempting to use:

  • RemoteWebDriver class from Selenium Webdriver
  • with a Chrome extension
  • and .NET bindings

You will seriously struggle. Whether you are attempting to create your own Selenium Grid or use a service like Sauce Labs or Browser Stack, the answer on the web is nowhere to be found. I spent days looking for a solution to this problem and could not find it anywhere.

The Solution

Finally, I turned to Stack Overflow where I posted a question and received an answer from Jim Evans. The problem with the .NET bindings is that unlike the Java implementation (and all of those examples online), we should NOT be using DesiredCapabilities, but rather should be using ChromeOptions. Below is the correct code to add a Chrome extension and get it working in a service like Sauce Labs.

Tear Down

Just a few key points that I’m going to mention because they are wrong all over the web for .NET:

  1. Use ChromeOptions instead of DesiredCapabilities
  2. You don’t need to specify CapabilityType.BrowserName as that is redundant
  3. When instantiating your RemoteWebDriver, just use the ToCapabilities() method on your ChromeOptions object.

Pin It on Pinterest

Shares
Share This