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

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

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

Exceptions

ArgumentNullException

If extensionToInstall is null.

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.

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()