how to disable chrome extension in selenium
Found a fix.
capabilities.setCapability("chrome.switches", Arrays.asList("--disable-extensions"));
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
Use the following to set chrome options:
ChromeOptions options = new ChromeOptions();options.addArguments("chrome.switches","--disable-extensions");