Package org.openqa.selenium.firefox
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.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
FirefoxDriverwith various options is to make use of theFirefoxOptions, 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 classFirefoxDriver.SystemProperty
-
Constructor Summary
Constructors Constructor Description FirefoxDriver()Creates a new FirefoxDriver using the {@link GeckoDriverService#createDefaultService)} server configuration.FirefoxDriver(FirefoxDriverService service)Creates a new FirefoxDriver instance.FirefoxDriver(FirefoxDriverService service, FirefoxOptions options)FirefoxDriver(FirefoxDriverService service, FirefoxOptions options, org.openqa.selenium.remote.http.ClientConfig clientConfig)FirefoxDriver(FirefoxOptions options)Creates a new FirefoxDriver instance with the specified options.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static org.openqa.selenium.remote.RemoteWebDriverBuilderbuilder()org.openqa.selenium.bidi.BiDigetBiDi()org.openqa.selenium.CapabilitiesgetCapabilities()FirefoxCommandContextgetContext()Current context commands are operating on.org.openqa.selenium.devtools.DevToolsgetDevTools()Deprecated.Use W3C-compliant BiDi protocol.<X> XgetFullPageScreenshotAs(org.openqa.selenium.OutputType<X> outputType)Capture the full page screenshot and store it in the specified location.org.openqa.selenium.html5.LocalStoragegetLocalStorage()org.openqa.selenium.html5.SessionStoragegetSessionStorage()java.lang.StringinstallExtension(java.nio.file.Path path)Installs an extension.java.lang.StringinstallExtension(java.nio.file.Path path, java.lang.Boolean temporary)java.util.Optional<org.openqa.selenium.bidi.BiDi>maybeGetBiDi()java.util.Optional<org.openqa.selenium.devtools.DevTools>maybeGetDevTools()Deprecated.Use W3C-compliant BiDi protocol.voidquit()voidsetContext(FirefoxCommandContext commandContext)Context commands are operating on.voidsetFileDetector(org.openqa.selenium.remote.FileDetector detector)voiduninstallExtension(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, findElements, findElements, get, getCommandExecutor, getCurrentUrl, 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
-
-
-
-
Constructor Detail
-
FirefoxDriver
public FirefoxDriver()
Creates a new FirefoxDriver using the {@link GeckoDriverService#createDefaultService)} server configuration.
-
FirefoxDriver
public FirefoxDriver(FirefoxOptions options)
Creates a new FirefoxDriver instance with the specified options.- Parameters:
options- The options to use.- See Also:
FirefoxDriver(FirefoxDriverService, FirefoxOptions)
-
FirefoxDriver
public FirefoxDriver(FirefoxDriverService service)
Creates a new FirefoxDriver instance. Theservicewill be started along with the driver, and shutdown upon callingquit().- Parameters:
service- The service to use.- See Also:
RemoteWebDriver(org.openqa.selenium.remote.CommandExecutor, Capabilities)
-
FirefoxDriver
public FirefoxDriver(FirefoxDriverService service, FirefoxOptions options)
-
FirefoxDriver
public FirefoxDriver(FirefoxDriverService service, FirefoxOptions options, org.openqa.selenium.remote.http.ClientConfig clientConfig)
-
-
Method Detail
-
builder
@Beta public static org.openqa.selenium.remote.RemoteWebDriverBuilder builder()
-
getCapabilities
public org.openqa.selenium.Capabilities getCapabilities()
- Specified by:
getCapabilitiesin interfaceorg.openqa.selenium.HasCapabilities- Overrides:
getCapabilitiesin classorg.openqa.selenium.remote.RemoteWebDriver
-
setFileDetector
public void setFileDetector(org.openqa.selenium.remote.FileDetector detector)
- Overrides:
setFileDetectorin classorg.openqa.selenium.remote.RemoteWebDriver
-
getLocalStorage
public org.openqa.selenium.html5.LocalStorage getLocalStorage()
- Specified by:
getLocalStoragein interfaceorg.openqa.selenium.html5.WebStorage
-
getSessionStorage
public org.openqa.selenium.html5.SessionStorage getSessionStorage()
- Specified by:
getSessionStoragein interfaceorg.openqa.selenium.html5.WebStorage
-
installExtension
public java.lang.String installExtension(java.nio.file.Path path)
Description copied from interface:HasExtensionsInstalls an extension.- Specified by:
installExtensionin interfaceHasExtensions- 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:
installExtensionin interfaceHasExtensions
-
uninstallExtension
public void uninstallExtension(java.lang.String extensionId)
Description copied from interface:HasExtensionsUninstall the extension by the given identifier. This value can be found in the extension's manifest, and typically ends with "@mozilla.org".- Specified by:
uninstallExtensionin interfaceHasExtensions- 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.WebDriverExceptionCapture the full page screenshot and store it in the specified location.- Specified by:
getFullPageScreenshotAsin interfaceHasFullPageScreenshot- 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:HasContextCurrent context commands are operating on.- Specified by:
getContextin interfaceHasContext- Returns:
FirefoxCommandContextvalue currently operating on commands
-
setContext
public void setContext(FirefoxCommandContext commandContext)
Description copied from interface:HasContextContext commands are operating on.- Specified by:
setContextin interfaceHasContext- Parameters:
commandContext-FirefoxCommandContextoperating on page loaded in the browser or on browser elements hosting the page.
-
maybeGetDevTools
@Deprecated public java.util.Optional<org.openqa.selenium.devtools.DevTools> maybeGetDevTools()
Deprecated.Use W3C-compliant BiDi protocol. Use {maybeGetBiDi()}- Specified by:
maybeGetDevToolsin interfaceorg.openqa.selenium.devtools.HasDevTools
-
getDevTools
@Deprecated public org.openqa.selenium.devtools.DevTools getDevTools()
Deprecated.Use W3C-compliant BiDi protocol. Use {getBiDi()}- Specified by:
getDevToolsin interfaceorg.openqa.selenium.devtools.HasDevTools
-
maybeGetBiDi
public java.util.Optional<org.openqa.selenium.bidi.BiDi> maybeGetBiDi()
- Specified by:
maybeGetBiDiin interfaceorg.openqa.selenium.bidi.HasBiDi
-
getBiDi
public org.openqa.selenium.bidi.BiDi getBiDi()
- Specified by:
getBiDiin interfaceorg.openqa.selenium.bidi.HasBiDi
-
quit
public void quit()
- Specified by:
quitin interfaceorg.openqa.selenium.WebDriver- Overrides:
quitin classorg.openqa.selenium.remote.RemoteWebDriver
-
-