网上查询需要 ChromeOptions,但是按照那种写法依旧会出现弹框
具体代码为:
public class Login {
public static void main(String[] args) {
String url = "https://deal-xxxx";
WebDriver driver = new ChromeDriver();
Map<String, Object> prefs = new HashMap<String, Object>();
prefs.put("profile.default_content_setting_values.notifications", 2);
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("prefs", prefs);
driver.manage().timeouts().implicitlyWait(2000, TimeUnit.SECONDS);
// driver.manage().window().maximize();
driver.get(url);
driver.findElement(By.className("account")).sendKeys("xxxxx");
driver.findElement(By.className("password")).sendKeys("xxxx");
driver.findElement(By.className("content")).click();
}
}