org.openqa.selenium.firefox
Class FirefoxProfile

java.lang.Object
  extended by org.openqa.selenium.firefox.FirefoxProfile

public class FirefoxProfile
extends java.lang.Object


Constructor Summary
  FirefoxProfile()
           
protected FirefoxProfile(java.io.File profileDir)
          Constructs a firefox profile from an existing, physical profile directory.
 
Method Summary
 java.io.File 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.
protected  void addWebDriverExtensionIfNeeded(boolean forceCreation)
           
 boolean alwaysLoadNoFocusLib()
          Returns whether the no focus library should be loaded for Firefox profiles launched on Linux, even if native events are disabled.
 void clean()
           
 void deleteExtensionsCacheIfItExists()
           
 boolean enableNativeEvents()
           
protected  org.openqa.selenium.firefox.Preferences getAdditionalPreferences()
           
 java.io.File getExtensionsDir()
           
 int getPort()
           
 java.io.File getProfileDir()
           
protected  void installDevelopmentExtension()
           
 boolean isRunning()
           
 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 setPort(int port)
           
 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.
 FirefoxProfile setProxyPreferences(Proxy proxy)
          Set proxy preferences for this profile.
 void updateUserPrefs()
           
protected  void writeNewPrefs(java.util.Map<java.lang.String,java.lang.String> prefs)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FirefoxProfile

protected FirefoxProfile(java.io.File profileDir)
Constructs a firefox profile from an existing, physical profile directory. Not a good idea, please don't.

Users who need this functionality should be using a named profile.

Parameters:
profileDir -

FirefoxProfile

public FirefoxProfile()
Method Detail

addWebDriverExtensionIfNeeded

protected void addWebDriverExtensionIfNeeded(boolean forceCreation)

addExtension

public java.io.File addExtension(java.lang.Class<?> loadResourcesUsing,
                                 java.lang.String loadFrom)
                          throws java.io.IOException
Throws:
java.io.IOException

addExtension

public void addExtension(java.io.File extensionToInstall)
                  throws java.io.IOException
Attempt to add an extension to install into this instance.

Parameters:
extensionToInstall -
Throws:
java.io.IOException

installDevelopmentExtension

protected void installDevelopmentExtension()
                                    throws java.io.IOException
Throws:
java.io.IOException

getProfileDir

public java.io.File getProfileDir()

getExtensionsDir

public java.io.File getExtensionsDir()

setPreference

public void setPreference(java.lang.String key,
                          java.lang.String value)
Set a preference for this particular profile. The value will be properly quoted before use. Note that if a value looks as if it is a quoted string (that is, starts with a quote character and ends with one too) an IllegalArgumentException is thrown: Firefox fails to start properly when some values are set to this.

Parameters:
key - The key
value - The new value.

setPreference

public void setPreference(java.lang.String key,
                          boolean value)
Set a preference for this particular profile.

Parameters:
key - The key
value - The new value.

setPreference

public void setPreference(java.lang.String key,
                          int value)
Set a preference for this particular profile.

Parameters:
key - The key
value - The new value.

setProxyPreferences

public FirefoxProfile setProxyPreferences(Proxy proxy)
Set proxy preferences for this profile.

Parameters:
proxy - The proxy preferences.
Returns:
The profile, for further settings.

getAdditionalPreferences

protected org.openqa.selenium.firefox.Preferences getAdditionalPreferences()

updateUserPrefs

public void updateUserPrefs()

deleteExtensionsCacheIfItExists

public void deleteExtensionsCacheIfItExists()

writeNewPrefs

protected void writeNewPrefs(java.util.Map<java.lang.String,java.lang.String> prefs)

getPort

public int getPort()

setPort

public void setPort(int port)

enableNativeEvents

public boolean enableNativeEvents()

setEnableNativeEvents

public void setEnableNativeEvents(boolean enableNativeEvents)

alwaysLoadNoFocusLib

public boolean alwaysLoadNoFocusLib()
Returns whether the no focus library should be loaded for Firefox profiles launched on Linux, even if native events are disabled.

Returns:
Whether the no focus library should always be loaded for Firefox on Linux.

setAlwaysLoadNoFocusLib

public void setAlwaysLoadNoFocusLib(boolean loadNoFocusLib)
Sets whether the no focus library should always be loaded on Linux.

Parameters:
loadNoFocusLib - Whether to always load the no focus library.

setAcceptUntrustedCertificates

public void setAcceptUntrustedCertificates(boolean acceptUntrustedSsl)
Sets whether Firefox should accept SSL certificates which have expired, signed by an unknown authority or are generally untrusted. This is set to true by defaul.t

Parameters:
acceptUntrustedSsl - Whether untrusted SSL certificates should be accepted.

setAssumeUntrustedCertificateIssuer

public 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. Due to limitation within Firefox, it is easy to find out if the certificate has expired or does not match the host it was served for, but hard to find out if the issuer of the certificate is untrusted. 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.

Parameters:
untrustedIssuer - whether to assume untrusted issuer or not.

isRunning

public boolean isRunning()

clean

public void clean()


Copyright © 2010. All Rights Reserved.