# Firefox

## fullPageScreenshot[​](#fullpagescreenshot "Direct link to fullPageScreenshot")

Captures a screenshot of the entire page.<br /><br />Firefox command. More details can be found in the [official protocol docs](https://phabricator.services.mozilla.com/source/mozilla-central/browse/default/testing/geckodriver/src/command.rs$43-46).

### Usage[​](#usage "Direct link to Usage")

```
await browser.fullPageScreenshot()
```

### Returns[​](#returns "Direct link to Returns")

* **\<String>** **`screenshot`:** The base64-encoded PNG image data comprising the screenshot of the full page.

***

## getMozContext[​](#getmozcontext "Direct link to getMozContext")

Get the context that is currently in effect, e.g. `CHROME` or `CONTENT`.<br /><br />Firefox command. More details can be found in the [official protocol docs](https://github.com/SeleniumHQ/selenium/blob/586affe0cf675b1d5c8abc756defa4a46d95391b/javascript/node/selenium-webdriver/firefox.js#L615-L622).

### Usage[​](#usage-1 "Direct link to Usage")

```
await browser.getMozContext()
```

### Example[​](#example "Direct link to Example")

```
console.log(await browser.getMozContext()); // outputs: 'CHROME'
```

### Returns[​](#returns-1 "Direct link to Returns")

* **\<String>** **`Context`:** The browser context, either `CHROME` or `CONTENT`

***

## setMozContext[​](#setmozcontext "Direct link to setMozContext")

Changes target context for commands between chrome- and content.<br /><br />Changing the current context has a stateful impact on all subsequent commands. The `CONTENT` context has normal web platform document permissions, as if you would evaluate arbitrary JavaScript. The `CHROME` context gets elevated permissions that lets you manipulate the browser chrome itself, with full access to the XUL toolkit.<br /><br />Firefox command. More details can be found in the [official protocol docs](https://github.com/SeleniumHQ/selenium/blob/586affe0cf675b1d5c8abc756defa4a46d95391b/javascript/node/selenium-webdriver/firefox.js#L615-L645).

### Usage[​](#usage-2 "Direct link to Usage")

```
await browser.setMozContext(context)
```

### Parameters[​](#parameters "Direct link to Parameters")

| Name      | Type     | Details                                           |
| --------- | -------- | ------------------------------------------------- |
| `context` | `string` | The browser context, either `CHROME` or `CONTENT` |

### Example[​](#example-1 "Direct link to Example")

```
console.log(await browser.getMozContext()); // outputs: 'CHROME'
browser.setMozContext('CONTENT');
console.log(await browser.getMozContext()); // outputs: 'CONTENT'
```

***

## installAddOn[​](#installaddon "Direct link to installAddOn")

Installs a new addon with the current session. This function will return an ID that may later be used to uninstall the addon using `uninstallAddon`.<br /><br />Firefox command. More details can be found in the [official protocol docs](https://github.com/SeleniumHQ/selenium/blob/586affe0cf675b1d5c8abc756defa4a46d95391b/javascript/node/selenium-webdriver/firefox.js#L647-L668).

### Usage[​](#usage-3 "Direct link to Usage")

```
await browser.installAddOn(addon, temporary)
```

### Parameters[​](#parameters-1 "Direct link to Parameters")

| Name        | Type      | Details                                                                                                   |
| ----------- | --------- | --------------------------------------------------------------------------------------------------------- |
| `addon`     | `string`  | base64 string of the add on file                                                                          |
| `temporary` | `boolean` | temporary Flag indicating whether the extension should be installed temporarily - gets removed on restart |

### Example[​](#example-2 "Direct link to Example")

```
// Create a buffer of the add on .zip file
const extension = await fs.promises.readFile('/path/to/extension.zip')
// Load extension in Firefox
const id = await browser.installAddOn(extension.toString('base64'), false);
```

### Returns[​](#returns-2 "Direct link to Returns")

* **\<String>** **`id`:** A promise that will resolve to an ID for the newly installed addon.

***

## uninstallAddOn[​](#uninstalladdon "Direct link to uninstallAddOn")

Uninstalls an addon from the current browser session's profile.<br /><br />Firefox command. More details can be found in the [official protocol docs](https://github.com/SeleniumHQ/selenium/blob/586affe0cf675b1d5c8abc756defa4a46d95391b/javascript/node/selenium-webdriver/firefox.js#L670-L687).

### Usage[​](#usage-4 "Direct link to Usage")

```
await browser.uninstallAddOn(id)
```

### Parameters[​](#parameters-2 "Direct link to Parameters")

| Name | Type     | Details                          |
| ---- | -------- | -------------------------------- |
| `id` | `string` | id ID of the addon to uninstall. |

### Example[​](#example-3 "Direct link to Example")

```
// Create a buffer of the add on .zip file
const extension = await fs.promises.readFile('/path/to/extension.zip')
// Load extension in Firefox
const id = await browser.installAddOn(extension.toString('base64'), false);
// ...
await browser.uninstallAddOn(id)
```
