Class FirefoxOptions
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
AndroidOptions
Gets or sets the options for automating Firefox on Android.
public FirefoxAndroidOptions AndroidOptions { get; set; }
Property Value
BinaryLocation
Gets or sets the path and file name of the Firefox browser executable.
public override string BinaryLocation { get; set; }
Property Value
BrowserExecutableLocation
Gets or sets the path and file name of the Firefox browser executable.
[Obsolete("Use BinaryLocation property instead of BrowserExecutableLocation. This one will be removed soon.")]
public string BrowserExecutableLocation { get; set; }
Property Value
EnableDevToolsProtocol
Gets or sets a value indicating whether to enable the DevTools protocol for the launched browser.
public bool EnableDevToolsProtocol { get; set; }
Property Value
LogLevel
Gets or sets the logging level of the Firefox driver.
public FirefoxDriverLogLevel LogLevel { get; set; }
Property Value
Profile
Gets or sets the FirefoxProfile object to be used with this instance.
public FirefoxProfile Profile { get; set; }
Property Value
Methods
AddAdditionalFirefoxOption(string, object)
Provides a means to add additional capabilities not yet added as type safe options for the Firefox driver.
public void AddAdditionalFirefoxOption(string optionName, object optionValue)
Parameters
optionName
stringThe name of the capability to add.
optionValue
objectThe value of the capability to add.
Remarks
Calling AddAdditionalFirefoxOption(string, object)
where optionName
has already been added will overwrite the
existing value with the new value in optionValue
.
Calling this method adds capabilities to the Firefox-specific options object passed to
geckodriver.exe (property name 'moz:firefoxOptions').
Exceptions
- ArgumentException
thrown when attempting to add a capability for which there is already a type safe option, or when
optionName
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
stringThe 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.
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 ("--").
SetEnvironmentVariable(string, string)
Sets an environment variable to be set in the operating system's environment under which the Firerox browser is launched.
public void SetEnvironmentVariable(string variableName, string variableValue)
Parameters
variableName
stringThe name of the environment variable.
variableValue
stringThe value of the environment variable.
SetPreference(string, bool)
Sets a preference in the profile used by Firefox.
public void SetPreference(string preferenceName, bool preferenceValue)
Parameters
preferenceName
stringName of the preference to set.
preferenceValue
boolValue 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
stringName of the preference to set.
preferenceValue
doubleValue 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
stringName of the preference to set.
preferenceValue
intValue 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
stringName of the preference to set.
preferenceValue
longValue 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
stringName of the preference to set.
preferenceValue
stringValue 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.