---
title: Setting the Firefox profile with Selenium WebDriver
description: Set and modify the Firefox profile during automated browser tests.
source_url:
  html: https://testingbot.com/support/web-automate/selenium/firefox-profile
  md: https://testingbot.com/support/web-automate/selenium/firefox-profile/index.md
---
# Firefox Profile

With Selenium WebDriver, it's possible to set a custom [Firefox profile](https://support.mozilla.org/en-US/kb/profile-manager-create-remove-switch-firefox-profiles), which will be used during your automated tests on TestingBot.   
 To change preferences and settings within Firefox, you'll need to instantiate a new `FirefoxProfile` object and update the properties of the profile.

## Change Firefox Profile

In the example below, we'll set the `accept language` to Spanish and change the `user-agent` header.

[Java](https://testingbot.com#)[Python](https://testingbot.com#)[NodeJS](https://testingbot.com#)[Ruby](https://testingbot.com#)[PHP](https://testingbot.com#)[C#](https://testingbot.com#)

    FirefoxOptions options = new FirefoxOptions();
    FirefoxProfile profile = new FirefoxProfile();
    profile.setPreference("general.useragent.override", "Custom-Agent"); // Change user-agent
    profile.setPreference("intl.accept_languages", "es"); // Setting accept language to Spanish
    options.setProfile(profile);
    options.setPlatformName("WIN11");
    options.setBrowserVersion("latest");
    
    HashMap<String, Object> tbOptions = new HashMap<>();
    tbOptions.put("key", "API_KEY");
    tbOptions.put("secret", "API_SECRET");
    tbOptions.put("name", "firefox profile example");
    options.setCapability("tb:options", tbOptions);
    
    WebDriver driver = new RemoteWebDriver(new URL("https://hub.testingbot.com/wd/hub"), options);

    from selenium import webdriver
    from selenium.webdriver.firefox.options import Options
    
    options = Options()
    options.set_preference('general.useragent.override', 'Custom-Agent') # Change user-agent
    options.set_preference('intl.accept_languages', 'es') # Setting accept language to Spanish
    options.browser_version = 'latest'
    options.platform_name = 'WIN11'
    options.set_capability('tb:options', {
      'key': 'API_KEY',
      'secret': 'API_SECRET',
      'name': 'firefox profile example'
    })
    
    driver = webdriver.Remote(
      command_executor='https://hub.testingbot.com/wd/hub',
      options=options
    )

    const { Builder } = require('selenium-webdriver');
    const firefox = require('selenium-webdriver/firefox');
    
    async function main() {
      let options = new firefox.Options();
      options.setPreference('general.useragent.override', 'Custom-Agent'); // Change user-agent
      options.setPreference('intl.accept_languages', 'es'); // Setting accept language to Spanish
      options.setBrowserVersion('latest');
      options.setPlatformName('WIN11');
      options.set('tb:options', {
        'key': 'API_KEY',
        'secret': 'API_SECRET',
        'name': 'firefox profile example'
      });
    
      let driver = await new Builder()
        .usingServer('https://hub.testingbot.com/wd/hub')
        .setFirefoxOptions(options)
        .build();
    }
    main();

    require 'rubygems'
    require 'selenium-webdriver'
    
    profile = Selenium::WebDriver::Firefox::Profile.new
    profile['general.useragent.override'] = 'Custom-Agent' # Change user-agent
    profile['intl.accept_languages'] = 'es' # Setting accept language to Spanish
    
    options = Selenium::WebDriver::Firefox::Options.new
    options.profile = profile
    options.browser_version = 'latest'
    options.platform_name = 'WIN11'
    options.add_option('tb:options', {
      'key' => 'API_KEY',
      'secret' => 'API_SECRET',
      'name' => 'firefox profile example'
    })
    
    driver = Selenium::WebDriver.for(:remote,
      url: 'https://hub.testingbot.com/wd/hub',
      options: options)

    require_once('vendor/autoload.php');
    use Facebook\WebDriver\Remote\RemoteWebDriver;
    use Facebook\WebDriver\Remote\DesiredCapabilities;
    use Facebook\WebDriver\Firefox\FirefoxOptions;
    use Facebook\WebDriver\Firefox\FirefoxProfile;
    
    $profile = new FirefoxProfile();
    $profile->setPreference('general.useragent.override', 'Custom-Agent'); // Change user-agent
    $profile->setPreference('intl.accept_languages', 'es'); // Setting accept language to Spanish
    
    $options = new FirefoxOptions();
    $options->setProfile($profile);
    
    $capabilities = DesiredCapabilities::firefox();
    $capabilities->setCapability(FirefoxOptions::CAPABILITY, $options);
    $capabilities->setCapability('browserVersion', 'latest');
    $capabilities->setCapability('platformName', 'WIN11');
    $capabilities->setCapability('tb:options', [
      'key' => 'API_KEY',
      'secret' => 'API_SECRET',
      'name' => 'firefox profile example'
    ]);
    
    $web_driver = RemoteWebDriver::create(
      'https://hub.testingbot.com/wd/hub',
      $capabilities
    );

    FirefoxProfile profile = new FirefoxProfile();
    profile.SetPreference("general.useragent.override", "Custom-Agent"); // Change user-agent
    profile.SetPreference("intl.accept_languages", "es"); // Setting accept language to Spanish
    
    FirefoxOptions options = new FirefoxOptions();
    options.Profile = profile;
    options.BrowserVersion = "latest";
    options.PlatformName = "WIN11";
    options.AddAdditionalOption("tb:options", new Dictionary<string, object>
    {
        ["key"] = "API_KEY",
        ["secret"] = "API_SECRET",
        ["name"] = "firefox profile example"
    });
    
    IWebDriver driver = new RemoteWebDriver(
      new Uri("https://hub.testingbot.com/wd/hub"), options
    );

Was this page helpful? Yes No 

## Looking for More Help?

Have questions or need more information?   
 You can reach us via the following channels:

- [Email us](https://testingbot.com/contact/new)
- [Join our Slack Channel](https://join.slack.com/t/testingb0t/shared_invite/zt-3bcw9xch-jk19~6XPs_xBrsAgAedkCw)
