Set Firefox Profile

To change the preferences within Firefox, instantiate a new FirefoxProfile object and update the preferences of the profile. Check out more preferences at the MozillaZine Knowledge Base.

In this example, a custom Firefox Profile is used to disable Flash in Firefox.

// Using a custom Firefox Profile to disable Flash

FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("plugin.state.flash", 0);
caps.setCapability(FirefoxDriver.PROFILE, profile);
// Install firefox-profile package
// npm install firefox-profile

var myProfile = new FirefoxProfile();

myProfile.setPreference("plugin.state.flash", 0);
myProfile.updatePreferences();
using OpenQA.Selenium.Firefox;

FirefoxProfile firefoxProfile = new FirefoxProfile();            
DesiredCapabilities caps = DesiredCapabilities.Firefox();
firefoxProfile.SetPreference("plugin.state.flash", 0);
caps.SetCapability(FirefoxDriver.ProfileCapabilityName, firefoxProfile.ToBase64String());
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("plugin.state.flash", 0);
caps.setCapability(FirefoxDriver.PROFILE, profile);
caps = DesiredCapabilities.FIREFOX
profile = webdriver.FirefoxProfile()
profile.set_preference('plugin.state.flash', 0)
profile.update_preferences()
driver = webdriver.Remote(
  command_executor='https://YOUR_USERNAME:YOUR_ACCESS_KEY@hub-cloud.browserstack.com/wd/hub',
  desired_capabilities=caps, browser_profile=profile)
profile = Selenium::WebDriver::Firefox::Profile.new
profile["plugin.state.flash"] = 0
caps = Selenium::WebDriver::Remote::Capabilities.firefox(:firefox_profile => profile)
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("plugin.state.flash", 0);
caps.setCapability(FirefoxDriver.PROFILE, profile);

We're sorry to hear that. Please share your feedback so we can do better






Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback