Skip to content

Latest commit

 

History

History
283 lines (172 loc) · 11.2 KB

firefox_profile.md

File metadata and controls

283 lines (172 loc) · 11.2 KB

Firefox Profile

Source: lib/firefox_profile.js

FirefoxProfile(options)

Initialize a new instance of a Firefox Profile.

Note that this function uses filesystem sync functions to copy an existing profile (id profileDirectory is provided) which is not optimized. If you need optimzed async version, use FirefoxProfile.copy(profileDirectory, cb);

Parameters:

  • {Object | String | null} options optional.

If it is an object, it can contain the following option:

  • profileDirectory: the profile to copy. Not recommended: use FirefoxProfile.copy instead
  • destinationDirectory: where the profile will be stored. If not provided, a tmp directory will be used WARNING: if the tmp directory will be deleted when the process will terminate.

if it is a string it will copy the directory synchronously (not recommended at all, kept for backward compatibility).

Go: TOC

FirefoxProfile.copy(options)

creates a profile Profile from an existing firefox profile directory asynchronously

Parameters:

  • {Object | String | null} options if it is an object, the following properties are available:
  • profileDirectory - required - the profile to copy.
  • destinationDirectory: where the profile will be stored. If not provided, a tmp directory will be used. WARNING: if the tmp directory will be deleted when the process exits.

Go: TOC | FirefoxProfile

FirefoxProfile.copyFromUserProfile()

copy a profile from the current user profile

Go: TOC | FirefoxProfile

FirefoxProfile.prototype.deleteDir(a)

Deletes the profile directory asynchronously.

Call it only if you do not need the profile. Otherwise use at your own risk.

Parameters:

  • {cb} a callback function with boolean parameter (false if the dir is not found) that will be called when the profileDir is deleted

Go: TOC | FirefoxProfile.prototype

FirefoxProfile.prototype._cleanOnExit()

called on exit to delete the profile directory synchronously.

this function is automatically called by default (= if willDeleteOnExit() returns true) if a tmp directory is used

should not be called directly. process.on('exit') cannot be asynchronous: async code is not called

Go: TOC | FirefoxProfile.prototype

FirefoxProfile.prototype.shouldDeleteOnExit(true)

Specify if the profile Directory should be deleted on process.exit()

Note: by default:

  • if the constructor is called without param: the new profile directory is deleted
  • if the constructor is called with param (path to profile dir): the dir is copied at init and the copy is deleted on exit

Parameters:

  • {boolean} true

Go: TOC | FirefoxProfile.prototype

FirefoxProfile.prototype.willDeleteOnExit()

returns true if the profile directory will be deleted on process.exit()

Return:

{boolean} true if (default)

Go: TOC | FirefoxProfile.prototype

FirefoxProfile.prototype.setPreference(key, value)

Set a user preference.

Any modification to the user preference can be persisted using this.updatePreferences() If this.setPreference() is called before calling this.encoded(), then this.updatePreferences() is automatically called. For a comprehensive list of preference keys, see http://kb.mozillazine.org/About:config_entries

Parameters:

  • {string} key - the user preference key
  • {boolean | string} value

See:

Go: TOC | FirefoxProfile.prototype

FirefoxProfile.prototype.addExtension(path, callback)

Add an extension to the profile.

Parameters:

  • {string} path - path to a xpi extension file or a unziped extension folder
  • {function} callback - the callback function to call when the extension is added

Go: TOC | FirefoxProfile.prototype

FirefoxProfile.prototype.addExtensions(extensions, callback)

Add mutliple extensions to the profile.

Parameters:

  • {Array} extensions - arrays of paths to xpi extension files or unziped extension folders
  • {function} callback - the callback function to call when the extension is added

Go: TOC | FirefoxProfile.prototype

FirefoxProfile.prototype.updatePreferences()

Save user preferences to the user.js profile file.

updatePreferences() is automatically called when encoded() is called (if needed = if setPreference() was called before calling encoded())

Go: TOC | FirefoxProfile.prototype

FirefoxProfile.prototype.path()

@return {string} path of the profile extension directory

Go: TOC | FirefoxProfile.prototype

FirefoxProfile.prototype.canAcceptUntrustedCerts()

@return {boolean} true if webdriver can accept untrusted certificates

Go: TOC | FirefoxProfile.prototype

FirefoxProfile.prototype.setAcceptUntrustedCerts(true)

If not explicitly set, default: true

Parameters:

  • {boolean} true to accept untrusted certificates, false otherwise.

Go: TOC | FirefoxProfile.prototype

FirefoxProfile.prototype.canAssumeUntrustedCertIssuer()

@return {boolean} true if webdriver can assume untrusted certificate issuer

Go: TOC | FirefoxProfile.prototype

FirefoxProfile.prototype.setAssumeUntrustedCertIssuer(true)

If not explicitly set, default: true

Parameters:

  • {boolean} true to make webdriver assume untrusted issuer.

Go: TOC | FirefoxProfile.prototype

FirefoxProfile.prototype.nativeEventsEnabled()

@return {boolean} true if native events are enabled

Go: TOC | FirefoxProfile.prototype

FirefoxProfile.prototype.setNativeEventsEnabled(boolean)

If not explicitly set, default: true

Parameters:

  • {boolean} boolean true to enable native events.

Go: TOC | FirefoxProfile.prototype

FirefoxProfile.prototype.encoded(function)

return zipped, base64 encoded string of the profile directory for use with remote WebDriver JSON wire protocol

Parameters:

  • {Function} function a callback function with first params as a zipped, base64 encoded string of the profile directory

Go: TOC | FirefoxProfile.prototype

FirefoxProfile.prototype.setProxy(proxy)

Set network proxy settings.

The parameter proxy is a hash which structure depends on the value of mandatory proxyType key, which takes one of the following string values:

  • direct - direct connection (no proxy)
  • system - use operating system proxy settings
  • pac - use automatic proxy configuration set based on the value of autoconfigUrl key
  • manual - manual proxy settings defined separately for different protocols using values from following keys: ftpProxy, httpProxy, sslProxy, socksProxy

Examples:

  • set automatic proxy:
 profile.setProxy({
     proxyType: 'pac',
     autoconfigUrl: 'http://myserver/proxy.pac'
 });
  • set manual http proxy:
 profile.setProxy({
     proxyType: 'manual',
     httpProxy: '127.0.0.1:8080'
 });
  • set manual http and https proxy:
 profile.setProxy({
     proxyType: 'manual',
     httpProxy: '127.0.0.1:8080',
     sslProxy: '127.0.0.1:8080'
 });

Parameters:

  • {Object} proxy a proxy hash, mandatory key proxyType

Go: TOC | FirefoxProfile.prototype

—generated by apidox