usr4896260
usr4896260

Reputation: 1507

ChromeDriver C# Disable developer extensions selenium

I'm trying to disable extensions when running selenium in my C# project. Using the example here, I was able to do so.

ChromeOptions options = new ChromeOptions();
options.AddArgument("--start-maximized");
options.AddArguments("--disable-extensions");
var drv = new ChromeDriver("MY_CHROME_DRIVER_PATH", options);

However, this doesn't work with the latest version of Chrome v63 and the selenium webdriver v2.9. After doing some research, I found that the driver includes an automation extension which is still enabled, when the disable extensions argument is passed. The suggestion used below does not work with the .NET driver.

chromeOptions.setExperimentalOption("useAutomationExtension", false);

As I have a managed machine and I can't enable the access to install Chrome extensions. How do I disable all extensions along with the automation extension in C#?

Upvotes: 2

Views: 5093

Answers (1)

usr4896260
usr4896260

Reputation: 1507

Thanks to JimEvans, I was able to find a solution by updating to the latest driver v2.35 and adding the additional capability as follows:

options.AddAdditionalCapability("useAutomationExtension", false);

Additionally, if one wants to the automation infobar, the can use the following:

options.AddArguments("--disable-infobars");

Upvotes: 3

Related Questions