Module: selenium-webdriver/firefox/profile
View Source

# class Profile

    webdriver.Serializable
      └ Profile

Models a Firefox proifle directory for use with the FirefoxDriver. The `Proifle` directory uses an in-memory model until `#writeToDisk` is called.

## new Profile(opt_dir)

Parameters

opt_dir`string=`

  Path to an existing Firefox profile directory to use a template for this profile. If not specified, a blank profile will be used.

## Instance Methods

### acceptUntrustedCerts()code »

Returns

`boolean`

  Whether the FirefoxDriver is configured to automatically accept untrusted SSL certificates.

### addExtension(extension)code »

Registers an extension to be included with this profile.

Parameters

extension`string`

  Path to the extension to include, as either an unpacked extension directory or the path to a xpi file.

### assumeUntrustedCertIssuer()code »

Returns

`boolean`

  Whether to assume untrusted certs come from untrusted issuers.

### encode()code »

Encodes this profile as a zipped, base64 encoded directory.

Returns

`webdriver.promise.Promise`

  A promise for the encoded profile.

### getPort()code »

Returns

`number`

  The port this profile is currently configured to use, or 0 if the port will be selected at random when the profile is written to disk.

### getPreference(key)code »

Returns the currently configured value of a profile preference. This does not include any defaults defined in the profile's template directory user.js file (if a template were specified on construction).

Parameters

key`string`

  The desired preference.

Returns

`(string|number|boolean|undefined)`

  The current value of the requested preference.

### nativeEventsEnabled()code »

Returns whether native events are enabled in this profile.

Returns

`boolean`

  .

### serialize()code »

Encodes this profile as a zipped, base64 encoded directory.

Overrides: webdriver.Serializable

Returns

`webdriver.promise.Promise`

  A promise for the encoded profile.

### setAcceptUntrustedCerts(value)code »

Sets whether the FirefoxDriver should automatically accept untrusted SSL certificates.

Parameters

value`boolean`

  .

### setAssumeUntrustedCertIssuer(value)code »

Sets whether to assume untrusted certificates come from untrusted issuers.

Parameters

value`boolean`

  .

### setNativeEventsEnabled(enabled)code »

Sets whether to use native events with this profile.

Parameters

enabled`boolean`

  .

### setPort(port)code »

Sets the port to use for the WebDriver extension loaded by this profile.

Parameters

port`number`

  The desired port, or 0 to use any free port.

### setPreference(key, value)code »

Sets a desired preference for this profile.

Parameters

key`string`

  The preference key.

value`(string|number|boolean)`

  The preference value.

Throws

`Error`

  If attempting to set a frozen preference.

### writeToDisk(opt_excludeWebDriverExt)code »

Writes this profile to disk.

Parameters

opt_excludeWebDriverExt`boolean=`

  Whether to exclude the WebDriver extension from the generated profile. Used to reduce the size of an `encoded profile` since the server will always install the extension itself.

Returns

`webdriver.promise.Promise`

  A promise for the path to the new profile directory.