Class FirefoxDriver

java.lang.Object
org.openqa.selenium.remote.RemoteWebDriver
org.openqa.selenium.firefox.FirefoxDriver
All Implemented Interfaces:
org.openqa.selenium.bidi.HasBiDi, org.openqa.selenium.devtools.HasDevTools, org.openqa.selenium.federatedcredentialmanagement.HasFederatedCredentialManagement, HasContext, HasExtensions, HasFullPageScreenshot, org.openqa.selenium.HasCapabilities, org.openqa.selenium.HasDownloads, org.openqa.selenium.html5.WebStorage, org.openqa.selenium.interactions.Interactive, org.openqa.selenium.JavascriptExecutor, org.openqa.selenium.PrintsPage, org.openqa.selenium.SearchContext, org.openqa.selenium.TakesScreenshot, org.openqa.selenium.virtualauthenticator.HasVirtualAuthenticator, org.openqa.selenium.WebDriver

public class FirefoxDriver extends org.openqa.selenium.remote.RemoteWebDriver implements org.openqa.selenium.html5.WebStorage, HasExtensions, HasFullPageScreenshot, HasContext, org.openqa.selenium.devtools.HasDevTools, org.openqa.selenium.bidi.HasBiDi
An implementation of the {#link WebDriver} interface that drives Firefox.

The best way to construct a FirefoxDriver with various options is to make use of the FirefoxOptions, like so:

 FirefoxOptions options = new FirefoxOptions()
     .addPreference("browser.startup.page", 1)
     .addPreference("browser.startup.homepage", "https://www.google.co.uk")
     .setAcceptInsecureCerts(true)
     .setHeadless(true);
 WebDriver driver = new FirefoxDriver(options);
 
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
     

    Nested classes/interfaces inherited from class org.openqa.selenium.remote.RemoteWebDriver

    org.openqa.selenium.remote.RemoteWebDriver.RemoteTargetLocator, org.openqa.selenium.remote.RemoteWebDriver.RemoteWebDriverOptions, org.openqa.selenium.remote.RemoteWebDriver.When

    Nested classes/interfaces inherited from interface org.openqa.selenium.WebDriver

    org.openqa.selenium.WebDriver.Navigation, org.openqa.selenium.WebDriver.Options, org.openqa.selenium.WebDriver.TargetLocator, org.openqa.selenium.WebDriver.Timeouts, org.openqa.selenium.WebDriver.Window
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new FirefoxDriver using the {@link GeckoDriverService#createDefaultService)} server configuration.
    Creates a new FirefoxDriver instance.
     
    FirefoxDriver(FirefoxDriverService service, FirefoxOptions options, org.openqa.selenium.remote.http.ClientConfig clientConfig)
     
    Creates a new FirefoxDriver instance with the specified options.
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.openqa.selenium.remote.RemoteWebDriverBuilder
     
    org.openqa.selenium.bidi.BiDi
     
    org.openqa.selenium.Capabilities
     
    Current context commands are operating on.
    org.openqa.selenium.devtools.DevTools
    Deprecated.
    Use W3C-compliant BiDi protocol.
    <X> X
    getFullPageScreenshotAs(org.openqa.selenium.OutputType<X> outputType)
    Capture the full page screenshot and store it in the specified location.
    org.openqa.selenium.html5.LocalStorage
    Deprecated.
    org.openqa.selenium.html5.SessionStorage
    Deprecated.
    Installs an extension.
    installExtension(Path path, Boolean temporary)
     
    Optional<org.openqa.selenium.bidi.BiDi>
     
    Optional<org.openqa.selenium.devtools.DevTools>
    Deprecated.
    Use W3C-compliant BiDi protocol.
    void
     
    void
    Context commands are operating on.
    void
    setFileDetector(org.openqa.selenium.remote.FileDetector detector)
     
    void
    Uninstall the extension by the given identifier.

    Methods inherited from class org.openqa.selenium.remote.RemoteWebDriver

    addVirtualAuthenticator, close, deleteDownloadableFiles, downloadFile, execute, execute, execute, executeAsyncScript, executeScript, findElement, findElements, findElements, get, getCommandExecutor, getCurrentUrl, getDownloadableFiles, getElementConverter, getErrorHandler, getExecuteMethod, getFederatedCredentialManagementDialog, getFileDetector, getPageSource, getScreenshotAs, getSessionId, getTitle, getWindowHandle, getWindowHandles, log, manage, navigate, perform, print, removeVirtualAuthenticator, resetCooldown, resetInputState, setCommandExecutor, setDelayEnabled, setElementConverter, setErrorHandler, setFoundBy, setLogLevel, setSessionId, startSession, switchTo, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.openqa.selenium.HasDownloads

    requireDownloadsEnabled

    Methods inherited from interface org.openqa.selenium.JavascriptExecutor

    executeScript, getPinnedScripts, pin, unpin
  • Constructor Details

  • Method Details

    • builder

      @Beta public static org.openqa.selenium.remote.RemoteWebDriverBuilder builder()
    • getCapabilities

      public org.openqa.selenium.Capabilities getCapabilities()
      Specified by:
      getCapabilities in interface org.openqa.selenium.HasCapabilities
      Overrides:
      getCapabilities in class org.openqa.selenium.remote.RemoteWebDriver
    • setFileDetector

      public void setFileDetector(org.openqa.selenium.remote.FileDetector detector)
      Overrides:
      setFileDetector in class org.openqa.selenium.remote.RemoteWebDriver
    • getLocalStorage

      @Deprecated public org.openqa.selenium.html5.LocalStorage getLocalStorage()
      Deprecated.
      Specified by:
      getLocalStorage in interface org.openqa.selenium.html5.WebStorage
    • getSessionStorage

      @Deprecated public org.openqa.selenium.html5.SessionStorage getSessionStorage()
      Deprecated.
      Specified by:
      getSessionStorage in interface org.openqa.selenium.html5.WebStorage
    • installExtension

      public String installExtension(Path path)
      Description copied from interface: HasExtensions
      Installs an extension.
      Specified by:
      installExtension in interface HasExtensions
      Parameters:
      path - absolute path to the extension file that should be installed.
      Returns:
      the unique identifier of the installed extension.
    • installExtension

      public String installExtension(Path path, Boolean temporary)
      Specified by:
      installExtension in interface HasExtensions
    • uninstallExtension

      public void uninstallExtension(String extensionId)
      Description copied from interface: HasExtensions
      Uninstall the extension by the given identifier. This value can be found in the extension's manifest, and typically ends with "@mozilla.org".
      Specified by:
      uninstallExtension in interface HasExtensions
      Parameters:
      extensionId - The unique extension identifier returned by {HasExtensions.installExtension(Path)}
    • getFullPageScreenshotAs

      public <X> X getFullPageScreenshotAs(org.openqa.selenium.OutputType<X> outputType) throws org.openqa.selenium.WebDriverException
      Capture the full page screenshot and store it in the specified location.
      Specified by:
      getFullPageScreenshotAs in interface HasFullPageScreenshot
      Type Parameters:
      X - Return type for getFullPageScreenshotAs.
      Parameters:
      outputType - target type, @see OutputType
      Returns:
      Object in which is stored information about the screenshot.
      Throws:
      org.openqa.selenium.WebDriverException - on failure.
    • getContext

      public FirefoxCommandContext getContext()
      Description copied from interface: HasContext
      Current context commands are operating on.
      Specified by:
      getContext in interface HasContext
      Returns:
      FirefoxCommandContext value currently operating on commands
    • setContext

      public void setContext(FirefoxCommandContext commandContext)
      Description copied from interface: HasContext
      Context commands are operating on.
      Specified by:
      setContext in interface HasContext
      Parameters:
      commandContext - FirefoxCommandContext operating on page loaded in the browser or on browser elements hosting the page.
    • maybeGetDevTools

      @Deprecated public Optional<org.openqa.selenium.devtools.DevTools> maybeGetDevTools()
      Deprecated.
      Use W3C-compliant BiDi protocol. Use {maybeGetBiDi()}
      Specified by:
      maybeGetDevTools in interface org.openqa.selenium.devtools.HasDevTools
    • getDevTools

      @Deprecated public org.openqa.selenium.devtools.DevTools getDevTools()
      Deprecated.
      Use W3C-compliant BiDi protocol. Use {getBiDi()}
      Specified by:
      getDevTools in interface org.openqa.selenium.devtools.HasDevTools
    • maybeGetBiDi

      public Optional<org.openqa.selenium.bidi.BiDi> maybeGetBiDi()
      Specified by:
      maybeGetBiDi in interface org.openqa.selenium.bidi.HasBiDi
    • getBiDi

      public org.openqa.selenium.bidi.BiDi getBiDi()
      Specified by:
      getBiDi in interface org.openqa.selenium.bidi.HasBiDi
    • quit

      public void quit()
      Specified by:
      quit in interface org.openqa.selenium.WebDriver
      Overrides:
      quit in class org.openqa.selenium.remote.RemoteWebDriver