我试图在启动我的 selenium chrome 时禁用所有 chrome 扩展。但是每次我运行代码时,所有扩展都会继续启动。有没有办法禁用扩展。
示例代码
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"));
}