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 the extensions.
public static void main(String[] args) throws IOException {
System.setProperty("webdriver.chrome.driver", "C:\\Selenium\\chromedriver.exe");
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability("chrome.binary", "C:\\Users\\ngzhongqin\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe");
WebDriver driver = new ChromeDriver(capabilities);
driver.get("http://www.cnn.com");
WebElement searchBox = driver.findElement(By.name("q"));
}
addArguments("--disable-extensions"); // Start the chrome session WebDriver driver = new ChromeDriver(options);
They can slow down your browser and even present security risks. It's worth taking a few minutes to look through your Chrome extensions to see which ones you have installed and whether you're actually using them. If you're not using them regularly, you should disable them.
Found a fix.
capabilities.setCapability("chrome.switches", Arrays.asList("--disable-extensions"));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With