问题描述
谁能告诉我如何禁用插件使用Java我的客户的Firefox配置文件?我已经找到了几个网站显示添加的附加组件,但没有关于禁用插件。
Can someone tell me how to disable plugins for my customer firefox profile using Java? I have found a few sites showing to add add-ons but nothing about disable plugins.
我的Firefox配置文件:
My firefox profile:
FirefoxProfile firefoxProfile = new FirefoxProfile();
firefoxProfile.setAcceptUntrustedCertificates(true);
firefoxProfile.setAssumeUntrustedCertificateIssuer(false);
firefoxProfile.setPreference("browser.download.folderList",2);
firefoxProfile.setPreference("browser.download.manager.showWhenStarting",false);
firefoxProfile.setPreference("browser.download.dir",reportFolder);
firefoxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk","text/csv,application/pdf,application/csv,application/vnd.ms-excel");
firefoxProfile.setPreference("browser.download.manager.showAlertOnComplete",false); firefoxProfile.setPreference("browser.download.manager.showAlertOnComplete",false);
firefoxProfile.setPreference("browser.download.manager.showWhenStartinge",false);
firefoxProfile.setPreference("browser.download.panel.shown",false);
firefoxProfile.setPreference("browser.download.useToolkitUI",true);
firefoxProfile.setPreference("pdfjs.disabled", true);
firefoxProfile.setPreference("pdfjs.firstRun", false);
driver = new FirefoxDriver(firefoxProfile);
问题是,默认情况下,这使一些插件。使用Adobe Acrobat,谷歌更新,JAVA,微软Office,闪光灯,冲击波对导演和Silverlight。
The problem is by default this has some plugins enabled. Adobe acrobat, google update, java, microsoft office, flash, shockwave for director and silverlight.
我需要关闭其中的一些,因为他们搞乱了我的测试。
I need to disable some of these as they are messing up my tests.
推荐答案
除非你正在创建一个明确安装Firefox扩展/插件硒的webdriver将创建一个空白的配置文件,并使用该配置文件。
Unless you are creating a profile that explicitly installs firefox extensions/plugins Selenium Webdriver will create a blank profile and use that.
你能告诉我们什么code您正在使用调用FF驱动程序?
Can you show us what code you are using to call the FF driver?
这篇关于硒禁用Firefox配置文件的插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!