org.openqa.selenium.firefox
Class FirefoxDriver

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

public class FirefoxDriver
extends java.lang.Object
implements WebDriver, JavascriptExecutor, TakesScreenshot, FindsById, FindsByClassName, FindsByCssSelector, FindsByLinkText, FindsByName, FindsByTagName, FindsByXPath

An implementation of the {#link WebDriver} interface that drives Firefox. This works through a firefox extension, which can be installed via the {#link FirefoxLauncher}. 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 interface org.openqa.selenium.WebDriver
WebDriver.Navigation, WebDriver.Options, WebDriver.TargetLocator
 
Field Summary
static boolean ACCEPT_UNTRUSTED_CERTIFICATES
           
protected  org.openqa.selenium.firefox.Context context
           
static boolean DEFAULT_ENABLE_NATIVE_EVENTS
           
static int DEFAULT_PORT
           
 
Constructor Summary
FirefoxDriver()
           
FirefoxDriver(FirefoxBinary binary, FirefoxProfile profile)
           
FirefoxDriver(FirefoxProfile profile)
           
FirefoxDriver(java.lang.String profileName)
           
FirefoxDriver(java.lang.String profileName, int port)
          Deprecated. Use "new ProfilesIni.getProfile(profileName)" and set the port on the returned profile
 
Method Summary
 void close()
           
protected  ExtensionConnection connectTo(FirefoxBinary binary, FirefoxProfile profile, java.lang.String host)
           
protected  java.lang.Object executeCommand(java.lang.Class<? extends java.lang.RuntimeException> throwOnFailure, Command command)
           
protected  java.lang.Object executeCommand(java.lang.Class<? extends java.lang.RuntimeException> throwOnFailure, java.lang.String methodName, java.lang.Object... parameters)
           
 java.lang.Object executeScript(java.lang.String script, java.lang.Object... args)
           
protected  WebDriver findActiveDriver()
           
 WebElement findElement(By by)
           
 WebElement findElementByClassName(java.lang.String using)
           
 WebElement findElementByCssSelector(java.lang.String using)
           
 WebElement findElementById(java.lang.String using)
           
 WebElement findElementByLinkText(java.lang.String using)
           
 WebElement findElementByName(java.lang.String using)
           
 WebElement findElementByPartialLinkText(java.lang.String using)
           
 WebElement findElementByTagName(java.lang.String using)
           
 WebElement findElementByXPath(java.lang.String using)
           
 java.util.List<WebElement> findElements(By by)
           
 java.util.List<WebElement> findElementsByClassName(java.lang.String using)
           
 java.util.List<WebElement> findElementsByCssSelector(java.lang.String using)
           
 java.util.List<WebElement> findElementsById(java.lang.String using)
           
 java.util.List<WebElement> findElementsByLinkText(java.lang.String using)
           
 java.util.List<WebElement> findElementsByName(java.lang.String using)
           
 java.util.List<WebElement> findElementsByPartialLinkText(java.lang.String using)
           
 java.util.List<WebElement> findElementsByTagName(java.lang.String using)
           
 java.util.List<WebElement> findElementsByXPath(java.lang.String using)
           
 void get(java.lang.String url)
           
 java.lang.String getCurrentUrl()
           
 java.lang.String getPageSource()
           
<X> X
getScreenshotAs(OutputType<X> target)
           
 java.lang.String getTitle()
           
 java.lang.String getWindowHandle()
           
 java.util.Set<java.lang.String> getWindowHandles()
           
 boolean isJavascriptEnabled()
           
 WebDriver.Options manage()
           
 WebDriver.Navigation navigate()
           
 java.lang.Object parseJavascriptObjectFromResponse(java.lang.String resultType, java.lang.Object response)
           
protected  void prepareEnvironment()
           
 void quit()
           
 void saveScreenshot(java.io.File pngFile)
          Deprecated. Use getScreenshotAs(file), which returns a temporary file.
protected  java.lang.String sendMessage(java.lang.Class<? extends java.lang.RuntimeException> throwOnFailure, Command command)
           
 WebDriver.TargetLocator switchTo()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PORT

public static final int DEFAULT_PORT
See Also:
Constant Field Values

DEFAULT_ENABLE_NATIVE_EVENTS

public static final boolean DEFAULT_ENABLE_NATIVE_EVENTS

ACCEPT_UNTRUSTED_CERTIFICATES

public static final boolean ACCEPT_UNTRUSTED_CERTIFICATES
See Also:
Constant Field Values

context

protected org.openqa.selenium.firefox.Context context
Constructor Detail

FirefoxDriver

public FirefoxDriver()

FirefoxDriver

public FirefoxDriver(java.lang.String profileName)

FirefoxDriver

@Deprecated
public FirefoxDriver(java.lang.String profileName,
                                int port)
Deprecated. Use "new ProfilesIni.getProfile(profileName)" and set the port on the returned profile


FirefoxDriver

public FirefoxDriver(FirefoxProfile profile)

FirefoxDriver

public FirefoxDriver(FirefoxBinary binary,
                     FirefoxProfile profile)
Method Detail

connectTo

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

prepareEnvironment

protected void prepareEnvironment()

close

public void close()
Specified by:
close in interface WebDriver

getPageSource

public java.lang.String getPageSource()
Specified by:
getPageSource in interface WebDriver

get

public void get(java.lang.String url)
Specified by:
get in interface WebDriver

getCurrentUrl

public java.lang.String getCurrentUrl()
Specified by:
getCurrentUrl in interface WebDriver

getTitle

public java.lang.String getTitle()
Specified by:
getTitle in interface WebDriver

findElements

public java.util.List<WebElement> findElements(By by)
Specified by:
findElements in interface SearchContext
Specified by:
findElements in interface WebDriver

findElement

public WebElement findElement(By by)
Specified by:
findElement in interface SearchContext
Specified by:
findElement in interface WebDriver

findElementById

public WebElement findElementById(java.lang.String using)
Specified by:
findElementById in interface FindsById

findElementsById

public java.util.List<WebElement> findElementsById(java.lang.String using)
Specified by:
findElementsById in interface FindsById

findElementByLinkText

public WebElement findElementByLinkText(java.lang.String using)
Specified by:
findElementByLinkText in interface FindsByLinkText

findElementsByLinkText

public java.util.List<WebElement> findElementsByLinkText(java.lang.String using)
Specified by:
findElementsByLinkText in interface FindsByLinkText

findElementByPartialLinkText

public WebElement findElementByPartialLinkText(java.lang.String using)
Specified by:
findElementByPartialLinkText in interface FindsByLinkText

findElementsByPartialLinkText

public java.util.List<WebElement> findElementsByPartialLinkText(java.lang.String using)
Specified by:
findElementsByPartialLinkText in interface FindsByLinkText

findElementsByXPath

public java.util.List<WebElement> findElementsByXPath(java.lang.String using)
Specified by:
findElementsByXPath in interface FindsByXPath

findElementByXPath

public WebElement findElementByXPath(java.lang.String using)
Specified by:
findElementByXPath in interface FindsByXPath

findElementsByClassName

public java.util.List<WebElement> findElementsByClassName(java.lang.String using)
Specified by:
findElementsByClassName in interface FindsByClassName

findElementByClassName

public WebElement findElementByClassName(java.lang.String using)
Specified by:
findElementByClassName in interface FindsByClassName

findElementByCssSelector

public WebElement findElementByCssSelector(java.lang.String using)
Specified by:
findElementByCssSelector in interface FindsByCssSelector

findElementsByCssSelector

public java.util.List<WebElement> findElementsByCssSelector(java.lang.String using)
Specified by:
findElementsByCssSelector in interface FindsByCssSelector

findElementByName

public WebElement findElementByName(java.lang.String using)
Specified by:
findElementByName in interface FindsByName

findElementsByName

public java.util.List<WebElement> findElementsByName(java.lang.String using)
Specified by:
findElementsByName in interface FindsByName

findElementByTagName

public WebElement findElementByTagName(java.lang.String using)
Specified by:
findElementByTagName in interface FindsByTagName

findElementsByTagName

public java.util.List<WebElement> findElementsByTagName(java.lang.String using)
Specified by:
findElementsByTagName in interface FindsByTagName

switchTo

public WebDriver.TargetLocator switchTo()
Specified by:
switchTo in interface WebDriver

navigate

public WebDriver.Navigation navigate()
Specified by:
navigate in interface WebDriver

findActiveDriver

protected WebDriver findActiveDriver()

sendMessage

protected java.lang.String sendMessage(java.lang.Class<? extends java.lang.RuntimeException> throwOnFailure,
                                       Command command)

executeCommand

protected java.lang.Object executeCommand(java.lang.Class<? extends java.lang.RuntimeException> throwOnFailure,
                                          java.lang.String methodName,
                                          java.lang.Object... parameters)

executeCommand

protected java.lang.Object executeCommand(java.lang.Class<? extends java.lang.RuntimeException> throwOnFailure,
                                          Command command)

quit

public void quit()
Specified by:
quit in interface WebDriver

getWindowHandle

public java.lang.String getWindowHandle()
Specified by:
getWindowHandle in interface WebDriver

getWindowHandles

public java.util.Set<java.lang.String> getWindowHandles()
Specified by:
getWindowHandles in interface WebDriver

executeScript

public java.lang.Object executeScript(java.lang.String script,
                                      java.lang.Object... args)
Specified by:
executeScript in interface JavascriptExecutor

parseJavascriptObjectFromResponse

public java.lang.Object parseJavascriptObjectFromResponse(java.lang.String resultType,
                                                          java.lang.Object response)

isJavascriptEnabled

public boolean isJavascriptEnabled()
Specified by:
isJavascriptEnabled in interface JavascriptExecutor

manage

public WebDriver.Options manage()
Specified by:
manage in interface WebDriver

getScreenshotAs

public <X> X getScreenshotAs(OutputType<X> target)
Specified by:
getScreenshotAs in interface TakesScreenshot

saveScreenshot

@Deprecated
public void saveScreenshot(java.io.File pngFile)
Deprecated. Use getScreenshotAs(file), which returns a temporary file.

Saves a screenshot of the current page into the given file.



Copyright © 2009. All Rights Reserved.