public class FirefoxProfile
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
ACCEPT_UNTRUSTED_CERTS_PREF |
private boolean |
acceptUntrustedCerts |
private Preferences |
additionalPrefs |
static java.lang.String |
ALLOWED_HOSTS_PREFERENCE |
private static java.lang.String |
ASSUME_UNTRUSTED_ISSUER_PREF |
private static java.lang.String |
defaultPrefs |
private java.util.Map<java.lang.String,Extension> |
extensions |
private boolean |
loadNoFocusLib |
private java.io.File |
model |
static java.lang.String |
PORT_PREFERENCE |
private boolean |
untrustedCertIssuer |
Modifier | Constructor and Description |
---|---|
|
FirefoxProfile() |
|
FirefoxProfile(java.io.File profileDir)
Constructs a firefox profile from an existing profile directory.
|
protected |
FirefoxProfile(java.io.Reader defaultsReader,
java.io.File profileDir) |
Modifier and Type | Method and Description |
---|---|
void |
addExtension(java.lang.Class<?> loadResourcesUsing,
java.lang.String loadFrom) |
void |
addExtension(java.io.File extensionToInstall)
Attempt to add an extension to install into this instance.
|
void |
addExtension(java.lang.String key,
Extension extension) |
boolean |
areNativeEventsEnabled()
Deprecated.
|
void |
clean(java.io.File profileDir) |
protected void |
cleanTemporaryModel() |
boolean |
containsWebDriverExtension() |
protected void |
copyModel(java.io.File sourceDir,
java.io.File profileDir) |
void |
deleteExtensionsCacheIfItExists(java.io.File profileDir) |
protected void |
deleteLockFiles(java.io.File profileDir) |
private java.lang.String |
deriveExtensionName(java.lang.String originalName) |
static FirefoxProfile |
fromJson(java.lang.String json) |
protected Preferences |
getAdditionalPreferences() |
private boolean |
getBooleanPreference(Preferences prefs,
java.lang.String key,
boolean defaultValue) |
boolean |
getBooleanPreference(java.lang.String key,
boolean defaultValue) |
int |
getIntegerPreference(java.lang.String key,
int defaultValue) |
java.lang.String |
getStringPreference(java.lang.String key,
java.lang.String defaultValue) |
protected void |
installExtensions(java.io.File parentDir) |
java.io.File |
layoutOnDisk()
Call this to cause the current profile to be written to disk.
|
protected java.io.Reader |
onlyOverrideThisIfYouKnowWhatYouAreDoing()
Internal method.
|
void |
setAcceptUntrustedCertificates(boolean acceptUntrustedSsl)
Sets whether Firefox should accept SSL certificates which have expired, signed by an unknown
authority or are generally untrusted.
|
void |
setAlwaysLoadNoFocusLib(boolean loadNoFocusLib)
Sets whether the no focus library should always be loaded on Linux.
|
void |
setAssumeUntrustedCertificateIssuer(boolean untrustedIssuer)
By default, when accepting untrusted SSL certificates, assume that these certificates will come
from an untrusted issuer or will be self signed.
|
void |
setEnableNativeEvents(boolean enableNativeEvents)
Deprecated.
|
void |
setPreference(java.lang.String key,
boolean value)
Set a preference for this particular profile.
|
void |
setPreference(java.lang.String key,
int value)
Set a preference for this particular profile.
|
void |
setPreference(java.lang.String key,
java.lang.String value)
Set a preference for this particular profile.
|
boolean |
shouldLoadNoFocusLib()
Returns whether the no focus library should be loaded for Firefox profiles launched on Linux,
even if native events are disabled.
|
java.lang.String |
toJson() |
void |
updateUserPrefs(java.io.File userPrefs) |
private void |
verifyModel(java.io.File model) |
public static final java.lang.String PORT_PREFERENCE
public static final java.lang.String ALLOWED_HOSTS_PREFERENCE
private static final java.lang.String defaultPrefs
private Preferences additionalPrefs
private java.util.Map<java.lang.String,Extension> extensions
private boolean loadNoFocusLib
private boolean acceptUntrustedCerts
private boolean untrustedCertIssuer
private java.io.File model
private static final java.lang.String ACCEPT_UNTRUSTED_CERTS_PREF
private static final java.lang.String ASSUME_UNTRUSTED_ISSUER_PREF
public FirefoxProfile()
public FirefoxProfile(java.io.File profileDir)
Users who need this functionality should consider using a named profile.
profileDir
- The profile directory to use as a model.@Beta protected FirefoxProfile(java.io.Reader defaultsReader, java.io.File profileDir)
@Beta protected java.io.Reader onlyOverrideThisIfYouKnowWhatYouAreDoing()
private boolean getBooleanPreference(Preferences prefs, java.lang.String key, boolean defaultValue)
public java.lang.String getStringPreference(java.lang.String key, java.lang.String defaultValue)
public int getIntegerPreference(java.lang.String key, int defaultValue)
public boolean getBooleanPreference(java.lang.String key, boolean defaultValue)
private void verifyModel(java.io.File model)
public boolean containsWebDriverExtension()
public void addExtension(java.lang.Class<?> loadResourcesUsing, java.lang.String loadFrom)
public void addExtension(java.io.File extensionToInstall)
extensionToInstall
- File pointing to the extensionpublic void addExtension(java.lang.String key, Extension extension)
private java.lang.String deriveExtensionName(java.lang.String originalName)
public void setPreference(java.lang.String key, java.lang.String value)
key
- The keyvalue
- The new value.public void setPreference(java.lang.String key, boolean value)
key
- The keyvalue
- The new value.public void setPreference(java.lang.String key, int value)
key
- The keyvalue
- The new value.protected Preferences getAdditionalPreferences()
public void updateUserPrefs(java.io.File userPrefs)
protected void deleteLockFiles(java.io.File profileDir)
public void deleteExtensionsCacheIfItExists(java.io.File profileDir)
@Deprecated public boolean areNativeEventsEnabled()
@Deprecated public void setEnableNativeEvents(boolean enableNativeEvents)
public boolean shouldLoadNoFocusLib()
public void setAlwaysLoadNoFocusLib(boolean loadNoFocusLib)
loadNoFocusLib
- Whether to always load the no focus library.public void setAcceptUntrustedCertificates(boolean acceptUntrustedSsl)
acceptUntrustedSsl
- Whether untrusted SSL certificates should be accepted.public void setAssumeUntrustedCertificateIssuer(boolean untrustedIssuer)
By default, it is assumed that the certificates were not be issued from a trusted CA.
If you are receive an "untrusted site" prompt on Firefox when using a certificate that was issued by valid issuer, but has expired or is being served served for a different host (e.g. production certificate served in a testing environment) set this to false.
untrustedIssuer
- whether to assume untrusted issuer or not.public void clean(java.io.File profileDir)
public java.lang.String toJson() throws java.io.IOException
java.io.IOException
public static FirefoxProfile fromJson(java.lang.String json) throws java.io.IOException
java.io.IOException
protected void cleanTemporaryModel()
public java.io.File layoutOnDisk()
FirefoxDriver
.protected void copyModel(java.io.File sourceDir, java.io.File profileDir) throws java.io.IOException
java.io.IOException
protected void installExtensions(java.io.File parentDir) throws java.io.IOException
java.io.IOException