Namespace: webdriver
View Source

# class Capabilities

    webdriver.Serializable<Object<string, ?>>
      └ webdriver.Capabilities

### new Capabilities(opt_other)

Parameters

opt_other`?Object=`

  Another set of capabilities to merge into this instance.

## Instance Methods

### get(key)code »

Parameters

key`string`

  The capability to return.

Returns

The capability with the given key, or `null` if it has not been set.

### has(key)code »

Parameters

key`string`

  The capability to check.

Returns

`boolean`

  Whether the specified capability is set.

### merge(other)code »

Merges another set of capabilities into this instance. Any duplicates in the provided set will override those already set on this instance.

Parameters

other`Object`

  The capabilities to merge into this instance.

Returns

`webdriver.Capabilities`

  A self reference.

### serialize()code »

Returns either this instance's serialized represention, if immediately available, or a promise for its serialized representation. This function is conceptually equivalent to objects that have a `toJSON()` property, except the serialize() result may be a promise or an object containing a promise (which are not directly JSON friendly).

Overrides: webdriver.Serializable

Returns

`Object<string, ?>`

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

### set(key, value)code »

Parameters

key`string`

  The capability to set.

value`*`

  The capability value. Capability values must be JSON serializable. Pass `null` to unset the capability.

Returns

`webdriver.Capabilities`

  A self reference.

### setAlertBehavior(behavior)code »

Sets the default action to take with an unexpected alert before returning an error.

Parameters

behavior`string`

  The desired behavior; should be "accept", "dismiss", or "ignore". Defaults to "dismiss".

Returns

`webdriver.Capabilities`

  A self reference.

### setEnableNativeEvents(enabled)code »

Sets whether native events should be used.

Parameters

enabled`boolean`

  Whether to enable native events.

Returns

`webdriver.Capabilities`

  A self reference.

### setLoggingPrefs(prefs)code »

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

Parameters

prefs`(webdriver.logging.Preferences|Object<string, string>)`

  The logging preferences.

Returns

`webdriver.Capabilities`

  A self reference.

### setProxy(proxy)code »

Sets the proxy configuration for this instance.

Parameters

proxy`{proxyType: string}`

  The desired proxy configuration.

Returns

`webdriver.Capabilities`

  A self reference.

### setScrollBehavior(behavior)code »

Sets how elements should be scrolled into view for interaction.

Parameters

behavior`number`

  The desired scroll behavior: either 0 to align with the top of the viewport or 1 to align with the bottom.

Returns

`webdriver.Capabilities`

  A self reference.

## Static Functions

### Capabilities.android()code »

Returns

`webdriver.Capabilities`

  A basic set of capabilities for Android.

### Capabilities.chrome()code »

Returns

`webdriver.Capabilities`

  A basic set of capabilities for Chrome.

### Capabilities.firefox()code »

Returns

`webdriver.Capabilities`

  A basic set of capabilities for Firefox.

### Capabilities.htmlunit()code »

Returns

`webdriver.Capabilities`

  A basic set of capabilities for HTMLUnit.

### Capabilities.htmlunitwithjs()code »

Returns

`webdriver.Capabilities`

  A basic set of capabilities for HTMLUnit with enabled Javascript.

### Capabilities.ie()code »

Returns

`webdriver.Capabilities`

  A basic set of capabilities for Internet Explorer.

### Capabilities.ipad()code »

Returns

`webdriver.Capabilities`

  A basic set of capabilities for iPad.

### Capabilities.iphone()code »

Returns

`webdriver.Capabilities`

  A basic set of capabilities for iPhone.

### Capabilities.opera()code »

Returns

`webdriver.Capabilities`

  A basic set of capabilities for Opera.

### Capabilities.phantomjs()code »

Returns

`webdriver.Capabilities`

  A basic set of capabilities for PhantomJS.

### Capabilities.safari()code »

Returns

`webdriver.Capabilities`

  A basic set of capabilities for Safari.