java+selenium,关闭chrome的通知弹窗

public class Login {
    public static void main(String[] args) {
        String url = "https://www.baidu.com/";

        Map prefs = new HashMap();
        prefs.put("profile.default_content_setting_values.notifications", 2);
        ChromeOptions options = new ChromeOptions();
        options.setExperimentalOption("prefs", prefs);
        WebDriver driver = new ChromeDriver(options);
    }
}

你可能感兴趣的:(java+selenium,关闭chrome的通知弹窗)