Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium disable plugins in firefox profile

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.

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);

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.

like image 255
Doctor Who Avatar asked May 30 '13 14:05

Doctor Who


1 Answers

Unless you are creating a profile that explicitly installs firefox extensions/plugins Selenium Webdriver will create a blank profile and use that.

Can you show us what code you are using to call the FF driver?

like image 129
Farlan Avatar answered Oct 14 '22 02:10

Farlan