I am trying to disable all chrome extensions when starting up my selenium chrome. But all extensions keep starting up each time I run the code. Is there a way of disabling t
Setting capability chrome.switches did not work for me (Chrome Version 53.0.2785.143 m, ChromeDriver 2.18.343845)
Instead using options works:
ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-extensions");
driver = new ChromeDriver(options);
or as per Chrome Driver documentation to set options as capability
ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-extensions");
caps.setCapability(ChromeOptions.CAPABILITY, options);
driver = new ChromeDriver(caps);
ChromeDriver(capabilities) is deprecated
Found a fix.
capabilities.setCapability("chrome.switches", Arrays.asList("--disable-extensions"));
Use the following to set chrome options:
ChromeOptions options = new ChromeOptions();
options.addArguments("chrome.switches","--disable-extensions");