我的想法是将木偶的详细程度设置为OFF !!
时它正在工作FirefoxOptions ffOptions = new FirefoxOptions();
ffOptions.setLogLevel(Level.OFF);
driver = new FirefoxDriver(ffOptions);
但是对于以下情况,它无法将详细程度设置为OFF
FirefoxOptions ffOptions = new FirefoxOptions();
ffOptions.setLogLevel(Level.OFF);
DesiredCapabilities ffCapabilities = DesiredCapabilities.firefox();
ffCapabilities.setCapability(FirefoxDriver.PROFILE, firefoxProfile());
ffCapabilities.setCapability("moz:firefoxOptions", ffOptions);
driver = new FirefoxDriver(ffCapabilities);
Firefox个人资料对象
protected FirefoxProfile firefoxProfile() {
FirefoxProfile fxProfile = new FirefoxProfile();
fxProfile.setAcceptUntrustedCertificates(true);
fxProfile.setPreference("browser.download.folderList", 2);
//FYI: this is working fine
fxProfile.setPreference("browser.download.dir", System.getProperty("user.dir") + ConfigCore.instance().downloadsDirectory());
fxProfile.setPreference("browser.download.manager.alertOnEXEOpen", false);
fxProfile.setPreference("browser.helperApps.neverAsk.openFile", "text/csv,application/csv,application/text");
fxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk", "text/csv,application/csv,application/text");
fxProfile.setPreference("browser.download.manager.showWhenStarting", false);
fxProfile.setPreference("browser.download.manager.focusWhenStarting", false);
fxProfile.setPreference("browser.download.useDownloadDir", true);
fxProfile.setPreference("browser.helperApps.alwaysAsk.force", false);
fxProfile.setPreference("browser.download.manager.alertOnEXEOpen", false);
fxProfile.setPreference("browser.download.manager.closeWhenDone", true);
fxProfile.setPreference("browser.download.manager.showAlertOnComplete", false);
fxProfile.setPreference("browser.download.manager.useWindow", false);
fxProfile.setPreference("services.sync.prefs.sync.browser.download.manager.showWhenStarting", false);
fxProfile.setPreference("browser.download.panel.shown", false);
fxProfile.setPreference("browser.download.animateNotifications", false);
fxProfile.setPreference("pdfjs.disabled", true);
return fxProfile;
}