public class FirefoxProfile extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
ALLOWED_HOSTS_PREFERENCE |
static String |
PORT_PREFERENCE |
| 构造器和说明 |
|---|
FirefoxProfile() |
FirefoxProfile(File profileDir)
Constructs a firefox profile from an existing profile directory.
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addExtension(Class<?> loadResourcesUsing,
String loadFrom) |
void |
addExtension(File extensionToInstall)
Attempt to add an extension to install into this instance.
|
void |
addExtension(String key,
Extension extension) |
boolean |
areNativeEventsEnabled() |
void |
clean(File profileDir) |
boolean |
containsWebDriverExtension() |
void |
deleteExtensionsCacheIfItExists(File profileDir) |
static FirefoxProfile |
fromJson(String json) |
boolean |
getBooleanPreference(String key,
boolean defaultValue) |
int |
getIntegerPreference(String key,
int defaultValue) |
String |
getStringPreference(String key,
String defaultValue) |
File |
layoutOnDisk()
Call this to cause the current profile to be written to disk.
|
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) |
void |
setPreference(String key,
boolean value)
Set a preference for this particular profile.
|
void |
setPreference(String key,
int value)
Set a preference for this particular profile.
|
void |
setPreference(String key,
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.
|
String |
toJson() |
void |
updateUserPrefs(File userPrefs) |
public FirefoxProfile()
public FirefoxProfile(File profileDir)
Users who need this functionality should consider using a named profile.
profileDir - The profile directory to use as a model.public int getIntegerPreference(String key, int defaultValue)
public boolean getBooleanPreference(String key, boolean defaultValue)
public boolean containsWebDriverExtension()
public void addExtension(File extensionToInstall)
extensionToInstall - File pointing to the extensionpublic void setPreference(String key, String value)
key - The keyvalue - The new value.public void setPreference(String key, boolean value)
key - The keyvalue - The new value.public void setPreference(String key, int value)
key - The keyvalue - The new value.public void updateUserPrefs(File userPrefs)
public void deleteExtensionsCacheIfItExists(File profileDir)
public boolean areNativeEventsEnabled()
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(File profileDir)
public String toJson() throws IOException
IOExceptionpublic static FirefoxProfile fromJson(String json) throws IOException
IOExceptionpublic File layoutOnDisk()
FirefoxDriver.