firefox选项似乎被忽略了?

gcmastyq  于 2021-07-03  发布在  Java
关注(0)|答案(0)|浏览(310)

我的想法是把 puppet 的冗长设置为关!!它工作的时候

FirefoxOptions ffOptions = new FirefoxOptions();
ffOptions.setLogLevel(Level.OFF);               
driver = new FirefoxDriver(ffOptions);

但对于以下情况,它无法将verbosity设置为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;
        }

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题