Constructor
new Options(otheropt)
Name | Type | Attributes | Description |
---|---|---|---|
other | Capabilities | | <optional> | Another set of capabilities to initialize this instance from. |
- Source
Methods
addArguments(…args) → (non-null) {Options}
Add additional command line arguments to use when launching the 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".
Name | Type | Attributes | Description |
---|---|---|---|
args | string | | <repeatable> | The arguments to add. |
- Source
A self reference.
- Type:
- Options
addExtensions(…args) → (non-null) {Options}
Add additional extensions to install when launching the browser. Each extension should be specified as the path to the packed CRX file, or a Buffer for an extension.
Name | Type | Attributes | Description |
---|---|---|---|
args | string | | <repeatable> | The extensions to add. |
- Source
A self reference.
- Type:
- Options
androidActivity(name) → (non-null) {Options}
Sets the name of the activity hosting a Chrome-based Android WebView. This option must be set to connect to an Android WebView
Name | Type | Description |
---|---|---|
name | string | The activity name. |
- Source
A self reference.
- Type:
- Options
androidDeviceSerial(serial) → (non-null) {Options}
Sets the device serial number to connect to via ADB. If not specified, the WebDriver server will select an unused device at random. An error will be returned if all devices already have active sessions.
Name | Type | Description |
---|---|---|
serial | string | The device serial number to connect to. |
- Source
A self reference.
- Type:
- Options
androidPackage(pkgnullable) → (non-null) {Options}
Sets the package name of the Chrome or WebView app.
Name | Type | Attributes | Description |
---|---|---|---|
pkg | string | <nullable> | The package to connect to, or |
- Source
A self reference.
- Type:
- Options
androidProcess(processName) → (non-null) {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.
Name | Type | Description |
---|---|---|
processName | string | The main activity name. |
- Source
A self reference.
- Type:
- Options
androidUseRunningApp(useRunning) → (non-null) {Options}
Sets whether to connect to an already-running instead of the specified app instead of launching the app with a clean data directory.
Name | Type | Description |
---|---|---|
useRunning | boolean | Whether to connect to a running instance. |
- Source
A self reference.
- Type:
- Options
debuggerAddress(address) → (non-null) {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").
Name | Type | Description |
---|---|---|
address | string | The address to connect to. |
- Source
A self reference.
- Type:
- Options
detachDriver(detach) → (non-null) {Options}
Sets whether to leave the started browser process running if the controlling driver service is killed before webdriver.WebDriver#quit() is called.
Name | Type | Description |
---|---|---|
detach | boolean | Whether to leave the browser running if the driver service is killed before the session. |
- Source
A self reference.
- Type:
- Options
enableBidi() → (non-null) {Capabilities}
Enable bidi connection
- Source
- Type:
- Capabilities
excludeSwitches(…args) → (non-null) {Options}
List of Chrome command line switches to exclude that ChromeDriver by default passes when starting Chrome. Do not prefix switches with "--".
Name | Type | Attributes | Description |
---|---|---|---|
args | string | | <repeatable> | The switches to exclude. |
- Source
A self reference.
- Type:
- Options
setBinaryPath(path) → (non-null) {Options}
Sets the path to the browser binary to use. On Mac OS X, this path should reference the actual Chromium executable, not just the application binary (e.g. "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome").
The binary path can be absolute or relative to the WebDriver server executable, but it must exist on the machine that will launch the browser.
Name | Type | Description |
---|---|---|
path | string | The path to the browser binary to use. |
- Source
A self reference.
- Type:
- Options
setBrowserLogFile(path) → (non-null) {Options}
Sets the path to the browser's log file. This path should exist on the machine that will launch the browser.
Name | Type | Description |
---|---|---|
path | string | Path to the log file to use. |
- Source
A self reference.
- Type:
- Options
setBrowserMinidumpPath(path) → (non-null) {Options}
Sets the directory to store browser minidumps in. This option is only supported when the driver is running on Linux.
Name | Type | Description |
---|---|---|
path | string | The directory path. |
- Source
A self reference.
- Type:
- Options
setLocalState(statenon-null) → (non-null) {Options}
Sets preferences for the "Local State" file in Chrome's user data directory.
Name | Type | Description |
---|---|---|
state | Object | Dictionary of local state preferences. |
- Source
A self reference.
- Type:
- Options
setMobileEmulation(confignullable) → (non-null) {Options}
Configures the browser 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 devicewidth
: screen width, in pixelsheight
: screen height, in pixelspixelRatio
: screen pixel ratio
Example 1: Using a Pre-configured Device
let options = new chrome.Options().setMobileEmulation(
{deviceName: 'Google Nexus 5'});
let driver = chrome.Driver.createSession(options);
Example 2: Using Custom Screen Configuration
let options = new chrome.Options().setMobileEmulation({deviceMetrics: {
width: 360,
height: 640,
pixelRatio: 3.0
}});
let driver = chrome.Driver.createSession(options);
Name | Type | Attributes | Description |
---|---|---|---|
config | Object | | <nullable> | The mobile emulation configuration, or |
- Source
A self reference.
- Type:
- Options
setPerfLoggingPrefs(prefs) → (non-null) {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, unlessenableTimeline
is explicitly set to true.traceCategories
: A comma-separated string of Chromium 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.
Name | Type | Description |
---|---|---|
prefs | Object | The performance logging preferences. |
- Source
A self reference.
- Type:
- Options
setUserPreferences(prefsnon-null) → (non-null) {Options}
Sets the user preferences for Chrome's user profile. See the "Preferences" file in Chrome's user data directory for examples.
Name | Type | Description |
---|---|---|
prefs | Object | Dictionary of user preferences to use. |
- Source
A self reference.
- Type:
- Options
windowSize(size) → (non-null) {Options}
Sets the initial window size.
Name | Type | Description |
---|---|---|
size | Object | The desired window size. |
- Source
if width or height is unspecified, not a number, or less than or equal to 0.
- Type
- TypeError
A self reference.
- Type:
- Options
windowTypes(…args) → (non-null) {Options}
Sets a list of the window types that will appear when getting window handles. For access to
Name | Type | Attributes | Description |
---|---|---|---|
args | string | | <repeatable> | The window types that will appear when getting window handles. |
- Source
A self reference.
- Type:
- Options