Class FirefoxDriver

  • All Implemented Interfaces:
    HasBiDi, org.openqa.selenium.devtools.HasDevTools, HasContext, HasExtensions, HasFullPageScreenshot, org.openqa.selenium.HasCapabilities, org.openqa.selenium.html5.WebStorage, org.openqa.selenium.interactions.HasInputDevices, 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, 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 class  FirefoxDriver.Capability  
      static class  FirefoxDriver.SystemProperty  
      • 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.ImeHandler, 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
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static org.openqa.selenium.remote.RemoteWebDriverBuilder builder()  
      BiDi getBiDi()  
      org.openqa.selenium.Capabilities getCapabilities()  
      FirefoxCommandContext getContext()
      Current context commands are operating on.
      org.openqa.selenium.devtools.DevTools getDevTools()  
      <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 getLocalStorage()  
      org.openqa.selenium.html5.SessionStorage getSessionStorage()  
      java.lang.String installExtension​(java.nio.file.Path path)
      Installs an extension.
      java.lang.String installExtension​(java.nio.file.Path path, java.lang.Boolean temporary)  
      java.util.Optional<BiDi> maybeGetBiDi()  
      java.util.Optional<org.openqa.selenium.devtools.DevTools> maybeGetDevTools()  
      void setContext​(FirefoxCommandContext commandContext)
      Context commands are operating on.
      void setFileDetector​(org.openqa.selenium.remote.FileDetector detector)  
      void uninstallExtension​(java.lang.String extensionId)
      Uninstall the extension by the given identifier.
      • Methods inherited from class org.openqa.selenium.remote.RemoteWebDriver

        addVirtualAuthenticator, close, execute, execute, execute, executeAsyncScript, executeScript, findElement, findElement, findElements, findElements, findElements, get, getCommandExecutor, getCurrentUrl, getElementConverter, getErrorHandler, getExecuteMethod, getFileDetector, getKeyboard, getMouse, getPageSource, getScreenshotAs, getSessionId, getTitle, getWindowHandle, getWindowHandles, log, manage, navigate, perform, print, quit, removeVirtualAuthenticator, resetInputState, setCommandExecutor, 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.JavascriptExecutor

        executeScript, getPinnedScripts, pin, unpin
    • Method Detail

      • 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

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

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

        public java.lang.String installExtension​(java.nio.file.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 java.lang.String installExtension​(java.nio.file.Path path,
                                                 java.lang.Boolean temporary)
        Specified by:
        installExtension in interface HasExtensions
      • uninstallExtension

        public void uninstallExtension​(java.lang.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.
      • maybeGetDevTools

        public java.util.Optional<org.openqa.selenium.devtools.DevTools> maybeGetDevTools()
        Specified by:
        maybeGetDevTools in interface org.openqa.selenium.devtools.HasDevTools
      • getDevTools

        public org.openqa.selenium.devtools.DevTools getDevTools()
        Specified by:
        getDevTools in interface org.openqa.selenium.devtools.HasDevTools