# Class Options

Class for managing ChromeDriver specific options.

#### Hierarchy

- Capabilities
  - Options

#####
Index

### Constructors

constructor

### Methods

[serialize]
addArguments
addExtensions
androidActivity
androidChrome
androidDeviceSerial
androidPackage
androidProcess
androidUseRunningApp
debuggerAddress
delete
detachDriver
excludeSwitches
get
getAcceptInsecureCerts
getAlertBehavior
getBrowserName
getBrowserVersion
getPageLoadStrategy
getPlatform
getProxy
has
headless
keys
merge
set
setAcceptInsecureCerts
setAlertBehavior
setBrowserName
setBrowserVersion
setChromeBinaryPath
setChromeLogFile
setChromeMinidumpPath
setLocalState
setLoggingPrefs
setMobileEmulation
setPageLoadStrategy
setPerfLoggingPrefs
setPlatform
setProxy
setUserPreferences
windowSize
chrome
edge
firefox
fromCapabilities
ie
safari

## Constructors

### constructor

- new Options(): Options

- #### Returns Options

  Overrides Capabilities.constructor

## Methods

### [serialize]

- [serialize](): {}

- #### Returns {}

  The JSON representation of this instance. Note, the returned object may contain nested promised values.

  #### Suppress

  Suppress [] access on a struct (state inherited from Map).

  Inherited from Capabilities.[serialize]

### addArguments

- addArguments(...var_args): Options

- Add additional command line arguments to use when launching the Chrome browser. Each argument may be specified with or without the '--' prefix (e.g. '--foo' and 'foo'). Arguments with an associated value should be delimited by an '=': 'foo=bar'.

  #### Parameters

  - ##### `Rest` ...var_args: string[]

    The arguments to add.

  #### Returns Options

  A self reference.

### addExtensions

- addExtensions(...var_args): Options

- Add additional extensions to install when launching Chrome. Each extension should be specified as the path to the packed CRX file, or a Buffer for an extension.

  #### Parameters

  - ##### `Rest` ...var_args: any[]

    The extensions to add.

  #### Returns Options

  A self reference.

### androidActivity

- androidActivity(name): Options

- Sets the name of the activity hosting a Chrome-based Android WebView. This option must be set to connect to an Android WebView

  #### Parameters

  - ##### name: string

    The activity name.

  #### Returns Options

  A self reference.

### androidChrome

- androidChrome(): Options

- Configures the ChromeDriver to launch Chrome on Android via adb. This function is shorthand for #androidPackage options.androidPackage('com.android.chrome').

  #### Returns Options

  A self reference.

### androidDeviceSerial

- androidDeviceSerial(serial): Options

- Sets the device serial number to connect to via ADB. If not specified, the ChromeDriver will select an unused device at random. An error will be returned if all devices already have active sessions.

  #### Parameters

  - ##### serial: string

    The device serial number to connect to.

  #### Returns Options

  A self reference.

### androidPackage

- androidPackage(pkg): Options

- Sets the package name of the Chrome or WebView app.

  #### Parameters

  - ##### pkg: string

    The package to connect to, or `null` to disable Android and switch back to using desktop Chrome.

  #### Returns Options

  A self reference.

### androidProcess

- androidProcess(processName): Options

- Sets the process name of the Activity hosting the WebView (as given by `ps`). If not specified, the process name is assumed to be the same as #androidPackage.

  #### Parameters

  - ##### processName: string

    The main activity name.

  #### Returns Options

  A self reference.

### androidUseRunningApp

- androidUseRunningApp(useRunning): Options

- Sets whether to connect to an already-running instead of the specified #androidProcess app instead of launching the app with a clean data directory.

  #### Parameters

  - ##### useRunning: boolean

    Whether to connect to a running instance.

  #### Returns Options

  A self reference.

### debuggerAddress

- debuggerAddress(address): Options

- Sets the address of a Chromium remote debugging server to connect to. Address should be of the form "{hostname|IP address}:port" (e.g. "localhost:9222").

  #### Parameters

  - ##### address: string

    The address to connect to.

  #### Returns Options

  A self reference.

### delete

- delete(key): boolean

- Deletes an entry from this set of capabilities.

  #### Parameters

  - ##### key: string

    the capability key to delete.

  #### Returns boolean

  Inherited from Capabilities.delete

### detachDriver

- detachDriver(detach): Options

- Sets whether to leave the started Chrome browser running if the controlling ChromeDriver service is killed before () is called.

  #### Parameters

  - ##### detach: boolean

    Whether to leave the browser running if the chromedriver service is killed before the session.

  #### Returns Options

  A self reference.

### excludeSwitches

- excludeSwitches(...var_args): Options

- List of Chrome command line switches to exclude that ChromeDriver by default passes when starting Chrome. Do not prefix switches with '--'.

  #### Parameters

  - ##### `Rest` ...var_args: string[]

    The switches to exclude.

  #### Returns Options

  A self reference.

### get

- get(key): any

- #### Parameters

  - ##### key: string

    The capability to return.

  #### Returns any

  The capability with the given key, or {@code null} if it has not been set.

  Inherited from Capabilities.get

### getAcceptInsecureCerts

- getAcceptInsecureCerts(): boolean

- #### Returns boolean

  whether the session is configured to accept insecure TLS certificates.

  Inherited from Capabilities.getAcceptInsecureCerts

### getAlertBehavior

- getAlertBehavior(): undefined | string

- #### Returns undefined | string

  the behavior pattern for responding to unhandled user prompts, or undefined if not set.

  Inherited from Capabilities.getAlertBehavior

### getBrowserName

- getBrowserName(): undefined | string

- #### Returns undefined | string

  the configured browser name, or undefined if not set.

  Inherited from Capabilities.getBrowserName

### getBrowserVersion

- getBrowserVersion(): undefined | string

- #### Returns undefined | string

  the configured browser version, or undefined if not set.

  Inherited from Capabilities.getBrowserVersion

### getPageLoadStrategy

- getPageLoadStrategy(): undefined | string

- Returns the configured page load strategy.

  #### Returns undefined | string

  the page load strategy.

  Inherited from Capabilities.getPageLoadStrategy

### getPlatform

- getPlatform(): undefined | string

- #### Returns undefined | string

  the configured platform or undefined if not set.

  Inherited from Capabilities.getPlatform

### getProxy

- getProxy(): undefined | ProxyConfig

- #### Returns undefined | ProxyConfig

  the configured proxy settings, or undefined if not set.

  Inherited from Capabilities.getProxy

### has

- has(key): boolean

- #### Parameters

  - ##### key: string

    The capability to check.

  #### Returns boolean

  Whether the specified capability is set.

  Inherited from Capabilities.has

### headless

- headless(): Options

- Configures the chromedriver to start Chrome in headless mode.

  > NOTE: Resizing the browser window in headless mode is only supported in Chrome 60. Users are encouraged to set an initial window size with the #windowSize windowSize({width, height)} option.

  #### Returns Options

  A self reference.

### keys

- keys(): IterableIterator<string, any, any>

- #### Returns IterableIterator<string, any, any>

  an iterator of the keys set.

  Inherited from Capabilities.keys

### merge

- merge(other): Capabilities

- Merges another set of capabilities into this instance.

  #### Parameters

  - ##### other: {} | Capabilities | Map<string, any>

    The other set of capabilities to merge.

  #### Returns Capabilities

  A self reference.

  Inherited from Capabilities.merge

### set

- set(key, value): Capabilities

- #### Parameters

  - ##### key: string

    The capability key.

  - ##### value: any

    The capability value.

  #### Returns Capabilities

  A self reference.

  #### Throws

  If the `key` is not a string.

  Inherited from Capabilities.set

### setAcceptInsecureCerts

- setAcceptInsecureCerts(accept): Capabilities

- Sets whether a WebDriver session should implicitly accept self-signed, or other untrusted TLS certificates on navigation.

  #### Parameters

  - ##### accept: boolean

    whether to accept insecure certs.

  #### Returns Capabilities

  a self reference.

  Inherited from Capabilities.setAcceptInsecureCerts

### setAlertBehavior

- setAlertBehavior(behavior): Capabilities

- Sets the default action to take with an unexpected alert before returning an error. If unspecified, WebDriver will default to UserPromptHandler.DISMISS_AND_NOTIFY.

  #### Parameters

  - ##### behavior: string

    The way WebDriver should respond to unhandled user prompts.

  #### Returns Capabilities

  A self reference.

  Inherited from Capabilities.setAlertBehavior

### setBrowserName

- setBrowserName(name): Capabilities

- Sets the name of the target browser.

  #### Parameters

  - ##### name: string

    the browser name.

  #### Returns Capabilities

  a self reference.

  Inherited from Capabilities.setBrowserName

### setBrowserVersion

- setBrowserVersion(version): Capabilities

- Sets the desired version of the target browser.

  #### Parameters

  - ##### version: string

    the desired version.

  #### Returns Capabilities

  a self reference.

  Inherited from Capabilities.setBrowserVersion

### setChromeBinaryPath

- setChromeBinaryPath(path): Options

- Sets the path to the Chrome binary to use. On Mac OS X, this path should reference the actual Chrome executable, not just the application binary (e.g. '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome').

  The binary path be absolute or relative to the chromedriver server executable, but it must exist on the machine that will launch Chrome.

  #### Parameters

  - ##### path: string

    The path to the Chrome binary to use.

  #### Returns Options

  A self reference.

### setChromeLogFile

- setChromeLogFile(path): Options

- Sets the path to Chrome's log file. This path should exist on the machine that will launch Chrome.

  #### Parameters

  - ##### path: string

    Path to the log file to use.

  #### Returns Options

  A self reference.

### setChromeMinidumpPath

- setChromeMinidumpPath(path): Options

- Sets the directory to store Chrome minidumps in. This option is only supported when ChromeDriver is running on Linux.

  #### Parameters

  - ##### path: string

    The directory path.

  #### Returns Options

  A self reference.

### setLocalState

- setLocalState(state): Options

- Sets preferences for the 'Local State' file in Chrome's user data directory.

  #### Parameters

  - ##### state: any

    Dictionary of local state preferences.

  #### Returns Options

  A self reference.

### setLoggingPrefs

- setLoggingPrefs(prefs): Capabilities

- Sets the logging preferences. Preferences may be specified as a ./logging.Preferences instance, or as a map of log-type to log-level.

  #### Parameters

  - ##### prefs: {} | Preferences

    The logging preferences.

  #### Returns Capabilities

  A self reference.

  Inherited from Capabilities.setLoggingPrefs

### setMobileEmulation

- setMobileEmulation(config): Options

- Configures Chrome to emulate a mobile device. For more information, refer to the ChromeDriver project page on mobile emulation. Configuration options include:

  - `deviceName`: The name of a pre-configured emulated device
  - `width`: screen width, in pixels
  - `height`: screen height, in pixels
  - `pixelRatio`: screen pixel ratio

  Example 1: Using a Pre-configured Device

      let options = new chrome.Options().setMobileEmulation(
          {deviceName: 'Google Nexus 5'});

      let driver = new chrome.Driver(options);

  Example 2: Using Custom Screen Configuration

      let options = new chrome.Options().setMobileEmulation({
          width: 360,
          height: 640,
          pixelRatio: 3.0
      });

      let driver = new chrome.Driver(options);

  #### Parameters

  - ##### config: any

    The mobile emulation configuration, or `null` to disable emulation.

  #### Returns Options

  A self reference.

### setPageLoadStrategy

- setPageLoadStrategy(strategy): Capabilities

- Sets the desired page loading strategy for a new WebDriver session.

  #### Parameters

  - ##### strategy: string

    the desired strategy.

  #### Returns Capabilities

  a self reference.

  Inherited from Capabilities.setPageLoadStrategy

### setPerfLoggingPrefs

- setPerfLoggingPrefs(prefs): Options

- Sets the performance logging preferences. Options include:

  - `enableNetwork`: Whether or not to collect events from Network domain.
  - `enablePage`: Whether or not to collect events from Page domain.
  - `enableTimeline`: Whether or not to collect events from Timeline domain. Note: when tracing is enabled, Timeline domain is implicitly disabled, unless `enableTimeline` is explicitly set to true.
  - `tracingCategories`: A comma-separated string of Chrome tracing categories for which trace events should be collected. An unspecified or empty string disables tracing.
  - `bufferUsageReportingInterval`: The requested number of milliseconds between DevTools trace buffer usage events. For example, if 1000, then once per second, DevTools will report how full the trace buffer is. If a report indicates the buffer usage is 100%, a warning will be issued.

  #### Parameters

  - ##### prefs: IPerfLoggingPrefs

    The performance logging preferences.

  #### Returns Options

  A self reference.

### setPlatform

- setPlatform(platform): Capabilities

- Sets the target platform.

  #### Parameters

  - ##### platform: string

    the target platform.

  #### Returns Capabilities

  a self reference.

  Inherited from Capabilities.setPlatform

### setProxy

- setProxy(proxy): Capabilities

- Sets the proxy configuration for this instance.

  #### Parameters

  - ##### proxy: ProxyConfig

    The desired proxy configuration.

  #### Returns Capabilities

  A self reference.

  Inherited from Capabilities.setProxy

### setUserPreferences

- setUserPreferences(prefs): Options

- Sets the user preferences for Chrome's user profile. See the 'Preferences' file in Chrome's user data directory for examples.

  #### Parameters

  - ##### prefs: any

    Dictionary of user preferences to use.

  #### Returns Options

  A self reference.

### windowSize

- windowSize(size): Options

- Sets the initial window size.

  #### Parameters

  - ##### size: {
    height: number;
    width: number;
    }

    The desired window size.

    - ##### height: number

    - ##### width: number

  #### Returns Options

  A self reference.

  #### Throws

  if width or height is unspecified, not a number, or less than or equal to 0.

### `Static` chrome

- chrome(): Capabilities

- #### Returns Capabilities

  A basic set of capabilities for Chrome.

  Inherited from Capabilities.chrome

### `Static` edge

- edge(): Capabilities

- #### Returns Capabilities

  A basic set of capabilities for Microsoft Edge.

  Inherited from Capabilities.edge

### `Static` firefox

- firefox(): Capabilities

- #### Returns Capabilities

  A basic set of capabilities for Firefox.

  Inherited from Capabilities.firefox

### `Static` fromCapabilities

- fromCapabilities(capabilities): Options

- Extracts the ChromeDriver specific options from the given capabilities object.

  #### Parameters

  - ##### capabilities: Capabilities

    The capabilities object.

  #### Returns Options

  The ChromeDriver options.

### `Static` ie

- ie(): Capabilities

- #### Returns Capabilities

  A basic set of capabilities for Internet Explorer.

  Inherited from Capabilities.ie

### `Static` safari

- safari(): Capabilities

- #### Returns Capabilities

  A basic set of capabilities for Safari.

  Inherited from Capabilities.safari

Generated using TypeDoc