Set Firefox Profile

Set a custom Firefox Profile for your tests that run on Firefox browsers in BrowserStack Automate

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 and accept French language in Firefox. You can make as many settings like these as you want.

// Using a custom Firefox Profile to disable Flash and set French as language

String URL = "";
FirefoxOptions ffOptions = new FirefoxOptions();
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("intl.accept_languages", "fr");  // Setting the locale language to accept French
profile.setPreference("plugin.state.flash", 0);  // Disabling Flash using Firefox profile
// More profile settings can be set using statements like above
ffOptions.setCapability("browser", "Firefox");
ffOptions.setCapability("os", "Windows");
WebDriver driver = new RemoteWebDriver(new URL(URL), ffOptions);
// Rest of your test case
// Install firefox-profile package
// npm install firefox-profile

var webdriver = require('selenium-webdriver');
var FirefoxProfile = require("firefox-profile");

var capabilities = webdriver.Capabilities.firefox();
// Input capabilities
capabilities.set("browserName", "firefox");
capabilities.set("os", "windows");

var myProfile = new FirefoxProfile();
myProfile.setPreference("plugin.state.flash", 0);  // Disabling Flash using Firefox profile
myProfile.setPreference("intl.accept_languages", "fr");  // Setting locale language to accept French

myProfile.encoded(function (err, encodedProfile) {
    capabilities.set("firefox_profile", encodedProfile);
  var driver = new webdriver.Builder().

  // Your test case goes here
IWebDriver driver;

// Input capabilities
FirefoxOptions capability = new FirefoxOptions();
capability.AddAdditionalCapability("browser", "Firefox", true);
capability.AddAdditionalCapability("os", "Windows", true);
capability.AddAdditionalCapability("browserstack.user", "YOUR_USERNAME", true);
capability.AddAdditionalCapability("browserstack.key", "YOUR_ACCESS_KEY", true);

FirefoxProfile firefoxProfile = new FirefoxProfile();
firefoxProfile.SetPreference("plugin.state.flash", 0);  // Disabling flash through Firefox Profile
firefoxProfile.SetPreference("intl.accept_languages", "fr");  // Setting French as the language
// Add as many preferences in the profile as you want
capability.Profile = firefoxProfile;
driver = new RemoteWebDriver(
  new Uri(""), capability
// Code for your test case goes here
use Facebook\WebDriver\Remote\RemoteWebDriver;
use Facebook\WebDriver\WebDriverBy;
use Facebook\WebDriver\Firefox\FirefoxProfile;

$profile = new FirefoxProfile();
$profile->setPreference('plugin.state.flash', 0);  // Disabling flash
$profile->setPreference('intl.accept_language', 'fr');  // Setting locale language to accept French
// You can configure as many profile settings as you want
$caps = array(
  "os_version" => "10",
  "browser" => "Firefox",
  "browser_version" => "latest",
  "os" => "Windows",
  "firefox_profile" => $profile
$web_driver = RemoteWebDriver::create(
// Your test code will go here
import requests
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile

# Input capabilities
desired_cap = {
 'browserName': 'firefox',
 'browserVersion': 'latest',
 'os': 'windows',
 'build': 'Python Sample Build',
 'name': 'firefox profile'
options = Options()
fp = webdriver.FirefoxProfile()
fp.set_preference('plugin.state.flash', 0)  # Disabling flash using Firefox profile
fp.set_preference('intl.accept_language', 'fr')  # Setting locale language to accept French
# You can make any number of settings using Firefox Profile
options.profile = fp
driver = webdriver.Remote(
# Your test code goes here
require "rubygems"
require "selenium-webdriver"

profile =
profile["plugin.state.flash"] = 0  # Disabling flash through this profile setting
profile["intl.accept_language"] = "fr"  # Setting locale language to accept French
# You can add as many settings in your Firefox profile as you want
caps = Selenium::WebDriver::Remote::Capabilities.firefox(:firefox_profile => profile)

caps["os"] = "Windows"
caps["os_version"] = "10"
caps["browser"] = "Firefox"
caps["browser_version"] = "latest"
caps["build"] = "Ruby Sample Build"
caps["name"] = "firefox profile test"

driver = Selenium::WebDriver.for(:remote,
  :url => "",
  :desired_capabilities => caps)

# Your test case goes here
use Selenium::Remote::Driver;
use Selenium::Firefox::Profile;

my $profile = Selenium::Firefox::Profile->new;
  'plugin.state.flash' => 0,  # Disabling flash using firefox profile
  'intl.accept_language' => 'fr'  # Setting locale language to accept French
# Input capabilities
my $extraCaps = {
  'browserName'=> 'firefox',
  'browserVersion'=> 'latest',
  'os'=> 'windows',
  'build'=>'Perl Sample Build',
  'name'=>'firefox profile test'
my $login = "YOUR_USERNAME";
my $key = "YOUR_ACCESS_KEY";
my $host = "$login:$key\";

my $driver = new Selenium::Remote::Driver('remote_server_addr' => $host,
  'port' => '80', 'extra_capabilities' => $extraCaps, 'firefox_profile' => $profile);
# Your test case goes here

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