org.openqa.selenium.firefox
Class FirefoxDriver

java.lang.Object
  extended by org.openqa.selenium.remote.RemoteWebDriver
      extended by org.openqa.selenium.firefox.FirefoxDriver
All Implemented Interfaces:
HasCapabilities, HasInputDevices, FindsByClassName, FindsByCssSelector, FindsById, FindsByLinkText, FindsByName, FindsByTagName, FindsByXPath, Killable, JavascriptExecutor, SearchContext, TakesScreenshot, WebDriver

public class FirefoxDriver
extends RemoteWebDriver
implements TakesScreenshot, Killable

An implementation of the {#link WebDriver} interface that drives Firefox. This works through a firefox extension, which gets installed automatically if necessary. Important system variables are:

When the driver starts, it will make a copy of the profile it is using, rather than using that profile directly. This allows multiple instances of firefox to be started.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.openqa.selenium.remote.RemoteWebDriver
RemoteWebDriver.RemoteTargetLocator, RemoteWebDriver.RemoteWebDriverOptions, RemoteWebDriver.When
 
Nested classes/interfaces inherited from interface org.openqa.selenium.WebDriver
WebDriver.ImeHandler, WebDriver.Navigation, WebDriver.Options, WebDriver.TargetLocator, WebDriver.Timeouts, WebDriver.Window
 
Field Summary
static boolean ACCEPT_UNTRUSTED_CERTIFICATES
          Deprecated. 
static boolean ASSUME_UNTRUSTED_ISSUER
          Deprecated. 
protected  FirefoxBinary binary
           
static java.lang.String BINARY
           
static boolean DEFAULT_ENABLE_NATIVE_EVENTS
           
static java.lang.String PROFILE
           
 
Constructor Summary
FirefoxDriver()
           
FirefoxDriver(Capabilities capabilities)
           
FirefoxDriver(FirefoxBinary binary, FirefoxProfile profile)
           
FirefoxDriver(FirefoxProfile profile)
           
 
Method Summary
protected  ExtensionConnection connectTo(FirefoxBinary binary, FirefoxProfile profile, java.lang.String host)
           
<X> X
getScreenshotAs(OutputType<X> target)
          Capture the screenshot and store it in the specified location.
 void kill()
          Attempt to forcibly kill this Killable at the OS level.
 WebDriver.Options manage()
          Gets the Option interface
protected  Lock obtainLock()
           
protected  void startClient()
          Method called before starting a new session.
protected  void stopClient()
          Method called after executing a RemoteWebDriver.quit() command.
 
Methods inherited from class org.openqa.selenium.remote.RemoteWebDriver
close, execute, execute, executeAsyncScript, executeScript, findElement, findElement, findElementByClassName, findElementByCssSelector, findElementById, findElementByLinkText, findElementByName, findElementByPartialLinkText, findElementByTagName, findElementByXPath, findElements, findElements, findElementsByClassName, findElementsByCssSelector, findElementsById, findElementsByLinkText, findElementsByName, findElementsByPartialLinkText, findElementsByTagName, findElementsByXPath, get, getCapabilities, getCommandExecutor, getCurrentUrl, getElementConverter, getErrorHandler, getExecuteMethod, getFileDetector, getKeyboard, getMouse, getPageSource, getSessionId, getTitle, getWindowHandle, getWindowHandles, log, navigate, quit, setCommandExecutor, setElementConverter, setFileDetector, setFoundBy, setLogLevel, setSessionId, startSession, switchTo, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BINARY

public static final java.lang.String BINARY
See Also:
Constant Field Values

PROFILE

public static final java.lang.String PROFILE
See Also:
Constant Field Values

DEFAULT_ENABLE_NATIVE_EVENTS

public static final boolean DEFAULT_ENABLE_NATIVE_EVENTS

ACCEPT_UNTRUSTED_CERTIFICATES

@Deprecated
public static final boolean ACCEPT_UNTRUSTED_CERTIFICATES
Deprecated. 
See Also:
Constant Field Values

ASSUME_UNTRUSTED_ISSUER

@Deprecated
public static final boolean ASSUME_UNTRUSTED_ISSUER
Deprecated. 
See Also:
Constant Field Values

binary

protected FirefoxBinary binary
Constructor Detail

FirefoxDriver

public FirefoxDriver()

FirefoxDriver

public FirefoxDriver(FirefoxProfile profile)

FirefoxDriver

public FirefoxDriver(Capabilities capabilities)

FirefoxDriver

public FirefoxDriver(FirefoxBinary binary,
                     FirefoxProfile profile)
Method Detail

kill

public void kill()
Attempt to forcibly kill this Killable at the OS level. Useful where the extension has stopped responding, and you don't want to leak resources. Should not ordinarily be called.

Specified by:
kill in interface Killable

manage

public WebDriver.Options manage()
Description copied from interface: WebDriver
Gets the Option interface

Specified by:
manage in interface WebDriver
Overrides:
manage in class RemoteWebDriver
Returns:
An option interface
See Also:
WebDriver.Options

startClient

protected void startClient()
Description copied from class: RemoteWebDriver
Method called before starting a new session. The default implementation is a no-op, but subtypes should override this method to define custom behavior.

Overrides:
startClient in class RemoteWebDriver

connectTo

protected ExtensionConnection connectTo(FirefoxBinary binary,
                                        FirefoxProfile profile,
                                        java.lang.String host)

obtainLock

protected Lock obtainLock()

stopClient

protected void stopClient()
Description copied from class: RemoteWebDriver
Method called after executing a RemoteWebDriver.quit() command. Subtypes

Overrides:
stopClient in class RemoteWebDriver

getScreenshotAs

public <X> X getScreenshotAs(OutputType<X> target)
Description copied from interface: TakesScreenshot
Capture the screenshot and store it in the specified location.

For WebDriver extending TakesScreenshot, this makes a best effort depending on the browser to return the following in order of preference:

For WebElement extending TakesScreenshot, this makes a best effort depending on the browser to return the following in order of preference: - The entire content of the HTML element - The visisble portion of the HTML element

Specified by:
getScreenshotAs in interface TakesScreenshot
Type Parameters:
X - Return type for getScreenshotAs.
Parameters:
target - target type, @see OutputType
Returns:
Object in which is stored information about the screenshot.