Table of Contents

Class FirefoxOptions

Namespace
OpenQA.Selenium.Firefox
Assembly
WebDriver.dll

Class to manage options specific to FirefoxDriver

public class FirefoxOptions : DriverOptions
Inheritance
FirefoxOptions
Inherited Members

Examples

FirefoxOptions options = new FirefoxOptions();

For use with FirefoxDriver:

FirefoxDriver driver = new FirefoxDriver(options);

For use with RemoteWebDriver:

RemoteWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), options.ToCapabilities());

Remarks

Used with the marionette executable wires.exe.

Constructors

FirefoxOptions()

Initializes a new instance of the FirefoxOptions class.

public FirefoxOptions()

Properties

BrowserExecutableLocation

Gets or sets the path and file name of the Firefox browser executable.

public string BrowserExecutableLocation { get; set; }

Property Value

string

LogLevel

Gets or sets the logging level of the Firefox driver.

public FirefoxDriverLogLevel LogLevel { get; set; }

Property Value

FirefoxDriverLogLevel

Profile

Gets or sets the FirefoxProfile object to be used with this instance.

public FirefoxProfile Profile { get; set; }

Property Value

FirefoxProfile

UseLegacyImplementation

Gets or sets a value indicating whether to use the legacy driver implementation.

public bool UseLegacyImplementation { get; set; }

Property Value

bool

Methods

AddAdditionalCapability(string, object)

Provides a means to add additional capabilities not yet added as type safe options for the Firefox driver.

public override void AddAdditionalCapability(string capabilityName, object capabilityValue)

Parameters

capabilityName string

The name of the capability to add.

capabilityValue object

The value of the capability to add.

Remarks

Calling AddAdditionalCapability(string, object) where capabilityName has already been added will overwrite the existing value with the new value in capabilityValue. Also, by default, calling this method adds capabilities to the options object passed to geckodriver.exe.

Exceptions

ArgumentException

thrown when attempting to add a capability for which there is already a type safe option, or when capabilityName is null or the empty string.

AddAdditionalCapability(string, object, bool)

Provides a means to add additional capabilities not yet added as type safe options for the Firefox driver.

public void AddAdditionalCapability(string capabilityName, object capabilityValue, bool isGlobalCapability)

Parameters

capabilityName string

The name of the capability to add.

capabilityValue object

The value of the capability to add.

isGlobalCapability bool

Indicates whether the capability is to be set as a global capability for the driver instead of a Firefox-specific option.

Remarks

Calling AddAdditionalCapability(string, object, bool) where capabilityName has already been added will overwrite the existing value with the new value in capabilityValue

Exceptions

ArgumentException

thrown when attempting to add a capability for which there is already a type safe option, or when capabilityName is null or the empty string.

AddArgument(string)

Adds an argument to be used in launching the Firefox browser.

public void AddArgument(string argumentName)

Parameters

argumentName string

The argument to add.

Remarks

Arguments must be preceeded by two dashes ("--").

AddArguments(IEnumerable<string>)

Adds a list arguments to be used in launching the Firefox browser.

public void AddArguments(IEnumerable<string> argumentsToAdd)

Parameters

argumentsToAdd IEnumerable<string>

An array of arguments to add.

Remarks

Each argument must be preceeded by two dashes ("--").

AddArguments(params string[])

Adds a list arguments to be used in launching the Firefox browser.

public void AddArguments(params string[] argumentsToAdd)

Parameters

argumentsToAdd string[]

An array of arguments to add.

Remarks

Each argument must be preceeded by two dashes ("--").

SetPreference(string, bool)

Sets a preference in the profile used by Firefox.

public void SetPreference(string preferenceName, bool preferenceValue)

Parameters

preferenceName string

Name of the preference to set.

preferenceValue bool

Value of the preference to set.

SetPreference(string, double)

Sets a preference in the profile used by Firefox.

public void SetPreference(string preferenceName, double preferenceValue)

Parameters

preferenceName string

Name of the preference to set.

preferenceValue double

Value of the preference to set.

SetPreference(string, int)

Sets a preference in the profile used by Firefox.

public void SetPreference(string preferenceName, int preferenceValue)

Parameters

preferenceName string

Name of the preference to set.

preferenceValue int

Value of the preference to set.

SetPreference(string, long)

Sets a preference in the profile used by Firefox.

public void SetPreference(string preferenceName, long preferenceValue)

Parameters

preferenceName string

Name of the preference to set.

preferenceValue long

Value of the preference to set.

SetPreference(string, string)

Sets a preference in the profile used by Firefox.

public void SetPreference(string preferenceName, string preferenceValue)

Parameters

preferenceName string

Name of the preference to set.

preferenceValue string

Value of the preference to set.

ToCapabilities()

Returns DesiredCapabilities for Firefox with these options included as capabilities. This does not copy the options. Further changes will be reflected in the returned capabilities.

public override ICapabilities ToCapabilities()

Returns

ICapabilities

The DesiredCapabilities for Firefox with these options.