Table of Contents

Class FirefoxProfile

Namespace
OpenQA.Selenium.Firefox
Assembly
WebDriver.dll

Provides the ability to edit the preferences associated with a Firefox profile.

public class FirefoxProfile
Inheritance
FirefoxProfile
Inherited Members

Constructors

FirefoxProfile()

Initializes a new instance of the FirefoxProfile class.

public FirefoxProfile()

FirefoxProfile(string)

Initializes a new instance of the FirefoxProfile class using a specific profile directory.

public FirefoxProfile(string profileDirectory)

Parameters

profileDirectory string

The directory containing the profile.

FirefoxProfile(string, bool)

Initializes a new instance of the FirefoxProfile class using a specific profile directory.

public FirefoxProfile(string profileDirectory, bool deleteSourceOnClean)

Parameters

profileDirectory string

The directory containing the profile.

deleteSourceOnClean bool

Delete the source directory of the profile upon cleaning.

Properties

AcceptUntrustedCertificates

Gets or sets a value indicating whether Firefox should accept SSL certificates which have expired, signed by an unknown authority or are generally untrusted. Set to true by default.

public bool AcceptUntrustedCertificates { get; set; }

Property Value

bool

AlwaysLoadNoFocusLibrary

Gets or sets a value indicating whether to always load the library for allowing Firefox to execute commands without its window having focus.

public bool AlwaysLoadNoFocusLibrary { get; set; }

Property Value

bool

Remarks

The AlwaysLoadNoFocusLibrary property is only used on Linux.

AssumeUntrustedCertificateIssuer

Gets or sets a value indicating whether Firefox assume untrusted SSL certificates come from an untrusted issuer or are self-signed. Set to true by default.

public bool AssumeUntrustedCertificateIssuer { get; set; }

Property Value

bool

Remarks

Due to limitations within Firefox, it is easy to find out if a certificate has expired or does not match the host it was served for, but hard to find out if the issuer of the certificate is untrusted. By default, it is assumed that the certificates were not issued from a trusted certificate authority.

If you receive an "untrusted site" prompt it Firefox when using a certificate that was issued by valid issuer, but the certificate has expired or is being served served for a different host (e.g. production certificate served in a testing environment) set this to false.

DeleteAfterUse

Gets or sets a value indicating whether to delete this profile after use with the FirefoxDriver.

public bool DeleteAfterUse { get; set; }

Property Value

bool

EnableNativeEvents

Gets or sets a value indicating whether native events are enabled.

public bool EnableNativeEvents { get; set; }

Property Value

bool

Port

Gets or sets the port on which the profile connects to the WebDriver extension.

public int Port { get; set; }

Property Value

int

ProfileDirectory

Gets the directory containing the profile.

public string ProfileDirectory { get; }

Property Value

string

Methods

AddExtension(string)

Adds a Firefox Extension to this profile

public void AddExtension(string extensionToInstall)

Parameters

extensionToInstall string

The path to the new extension

Clean()

Cleans this Firefox profile.

public void Clean()

Remarks

If this profile is a named profile that existed prior to launching Firefox, the Clean() method removes the WebDriver Firefox extension. If the profile is an anonymous profile, the profile is deleted.

FromBase64String(string)

Converts a base64-encoded string into a FirefoxProfile.

public static FirefoxProfile FromBase64String(string base64)

Parameters

base64 string

The base64-encoded string containing the profile contents.

Returns

FirefoxProfile

The constructed FirefoxProfile.

SetPreference(string, bool)

Sets a preference in the profile.

public void SetPreference(string name, bool value)

Parameters

name string

The name of the preference to add.

value bool

A bool value to add to the profile.

SetPreference(string, int)

Sets a preference in the profile.

public void SetPreference(string name, int value)

Parameters

name string

The name of the preference to add.

value int

A int value to add to the profile.

SetPreference(string, string)

Sets a preference in the profile.

public void SetPreference(string name, string value)

Parameters

name string

The name of the preference to add.

value string

A string value to add to the profile.

SetProxyPreferences(Proxy)

Set proxy preferences for this profile.

public void SetProxyPreferences(Proxy proxy)

Parameters

proxy Proxy

The Proxy object defining the proxy preferences for the profile.

ToBase64String()

Converts the profile into a base64-encoded string.

public string ToBase64String()

Returns

string

A base64-encoded string containing the contents of the profile.

WriteToDisk()

Writes this in-memory representation of a profile to disk.

public void WriteToDisk()