selenium-webdriver/firefox~ Driver

A WebDriver client for Firefox.

Constructor

new Driver()

Methods

getContext() → (non-null) {Promise.<Context>}

Get the context that is currently in effect.

Returns:

Current context.

Type: 
Promise.<Context>

(async) installAddon(path, temporary) → (non-null) {Promise.<string>}

Installs a new addon with the current session. This function will return an ID that may later be used to uninstall the addon.

Parameters:
NameTypeDefaultDescription
pathstring

Path on the local filesystem to the web extension to install.

temporarybooleanfalse

Flag indicating whether the extension should be installed temporarily - gets removed on restart

Returns:

A promise that will resolve to an ID for the newly installed addon.

Type: 
Promise.<string>

setContext(ctxnon-null)

Changes target context for commands between chrome- and content.

Changing the current context has a stateful impact on all subsequent commands. The Context.CONTENT context has normal web platform document permissions, as if you would evaluate arbitrary JavaScript. The Context.CHROME context gets elevated permissions that lets you manipulate the browser chrome itself, with full access to the XUL toolkit.

Use your powers wisely.

Parameters:
NameTypeDescription
ctxPromise.<void>

The context to switch to.

setFileDetector()

This function is a no-op as file detectors are not supported by this implementation.

takeFullPageScreenshot() → (non-null) {Promise.<string>}

Take full page screenshot of the visible region

Returns:

A promise that will be resolved to the screenshot as a base-64 encoded PNG.

Type: 
Promise.<string>

(async) uninstallAddon(id) → (non-null) {Promise}

Uninstalls an addon from the current browser session's profile.

Parameters:
NameTypeDescription
idstring | !Promise.<string>

ID of the addon to uninstall.

Returns:

A promise that will resolve when the operation has completed.

Type: 
Promise

(static) createSession(opt_configopt, opt_executoropt) → (non-null) {Driver}

Creates a new Firefox session.

Parameters:
NameTypeAttributesDescription
opt_configOptions | Capabilities | Object<optional>

The configuration options for this driver, specified as either an Options or Capabilities, or as a raw hash object.

opt_executorhttp.Executor | remote.DriverService<optional>

Either a pre-configured command executor to use for communicating with an externally managed remote end (which is assumed to already be running), or the DriverService to use to start the geckodriver in a child process.

If an executor is provided, care should e taken not to use reuse it with other clients as its internal command mappings will be updated to support Firefox-specific commands.

This parameter may only be used with Mozilla's GeckoDriver.

Throws:

If a custom command executor is provided and the driver is configured to use the legacy FirefoxDriver from the Selenium project.

Type
Error
Returns:

A new driver instance.

Type: 
Driver