C# Class OpenQA.Selenium.Firefox.FirefoxProfile

Provides the ability to edit the preferences associated with a Firefox profile.
Exibir arquivo Open project: asynchrony/Selenium2 Class Usage Examples

Public Methods

Method Description
AddExtension ( string extensionToInstall ) : void

Adds a Firefox Extension to this profile

Clean ( ) : void

Cleans this Firefox profile.

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.

FirefoxProfile ( ) : System

Initializes a new instance of the FirefoxProfile class.

FirefoxProfile ( string profileDirectory ) : System

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

FirefoxProfile ( string profileDirectory, bool deleteSourceOnClean ) : System

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

FromBase64String ( string base64 ) : FirefoxProfile

Converts a base64-encoded string into a FirefoxProfile.

SetPreference ( string name, bool value ) : void

Sets a preference in the profile.

SetPreference ( string name, int value ) : void

Sets a preference in the profile.

SetPreference ( string name, string value ) : void

Sets a preference in the profile.

ToBase64String ( ) : string

Converts the profile into a base64-encoded string.

WriteToDisk ( ) : void

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

Private Methods

Method Description
AddDefaultPreference ( string>.Dictionary preferences, string name, string value ) : void

Adds a preference to the profile.

AddWebDriverExtension ( ) : void

Adds the WebDriver extension for Firefox to the profile.

DeleteExtensionsCache ( ) : void

Deletes the cache of extensions for this profile, if the cache exists.

If the extensions cache does not exist for this profile, the DeleteExtensionsCache method performs no operations, but succeeds.

DeleteLockFiles ( ) : void

Deletes the lock files for a profile.

GenerateProfileDirectoryName ( ) : string

Generates a random directory name for the profile.

InstallExtensions ( ) : void

Installs all extensions in the profile in the directory on disk.

ReadExistingPreferences ( ) : string>.Dictionary

Reads the existing preferences from the profile.

Assumes that we only really care about the preferences, not the comments

UpdateUserPreferences ( ) : void

Writes the user preferences to the profile.

WriteNewPreferences ( string>.Dictionary preferences ) : void

Writes the specified preferences to the user preferences file.

Method Details

AddExtension() public method

Adds a Firefox Extension to this profile
public AddExtension ( string extensionToInstall ) : void
extensionToInstall string The path to the new extension
return void

Clean() public method

Cleans this Firefox profile.
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.
public Clean ( ) : void
return void

FirefoxProfile() public method

Initializes a new instance of the FirefoxProfile class.
public FirefoxProfile ( ) : System
return System

FirefoxProfile() public method

Initializes a new instance of the FirefoxProfile class using a specific profile directory.
public FirefoxProfile ( string profileDirectory ) : System
profileDirectory string The directory containing the profile.
return System

FirefoxProfile() public method

Initializes a new instance of the FirefoxProfile class using a specific profile directory.
public FirefoxProfile ( string profileDirectory, bool deleteSourceOnClean ) : System
profileDirectory string The directory containing the profile.
deleteSourceOnClean bool Delete the source directory of the profile upon cleaning.
return System

FromBase64String() public static method

Converts a base64-encoded string into a FirefoxProfile.
public static FromBase64String ( string base64 ) : FirefoxProfile
base64 string The base64-encoded string containing the profile contents.
return FirefoxProfile

SetPreference() public method

Sets a preference in the profile.
public SetPreference ( string name, bool value ) : void
name string The name of the preference to add.
value bool A value to add to the profile.
return void

SetPreference() public method

Sets a preference in the profile.
public SetPreference ( string name, int value ) : void
name string The name of the preference to add.
value int A value to add to the profile.
return void

SetPreference() public method

Sets a preference in the profile.
public SetPreference ( string name, string value ) : void
name string The name of the preference to add.
value string A value to add to the profile.
return void

ToBase64String() public method

Converts the profile into a base64-encoded string.
public ToBase64String ( ) : string
return string

WriteToDisk() public method

Writes this in-memory representation of a profile to disk.
public WriteToDisk ( ) : void
return void