Options

Options for configuring an executed command.

Interfaces

Cookie

Members

args :!Array.<string>|undefined

Command line arguments for the child process, if any.

Type:
  • !Array.<string> | undefined

env :!Object.<string, string>|undefined

Environment variables for the spawned process. If unspecified, the child will inherit this process' environment.

Type:
  • !Object.<string, string> | undefined

stdio :string|!Array.<(string|number|!stream.Stream|null|undefined)>|undefined

IO conifguration for the spawned server child process. If unspecified, the child process' IO output will be ignored.

Type:
  • string | !Array.<(string|number|!stream.Stream|null|undefined)> | undefined

Methods

addCookie(specnon-null) → (non-null) {Promise.<void>}

Adds a cookie.

Sample Usage:

// Set a basic cookie.
driver.manage().addCookie({name: 'foo', value: 'bar'});

// Set a cookie that expires in 10 minutes.
let expiry = new Date(Date.now() + (10 * 60 * 1000));
driver.manage().addCookie({name: 'foo', value: 'bar', expiry});

// The cookie expiration may also be specified in seconds since epoch.
driver.manage().addCookie({
  name: 'foo',
  value: 'bar',
  expiry: Math.floor(Date.now() / 1000)
});
Parameters:
NameTypeDescription
specOptions.Cookie

Defines the cookie to add.

Throws:
  • if any of the cookie parameters are invalid.

    Type
    error.InvalidArgumentError
  • if spec is not a cookie object.

    Type
    TypeError
Returns:

A promise that will be resolved when the cookie has been added to the page.

Type: 
Promise.<void>

deleteAllCookies() → (non-null) {Promise.<void>}

Deletes all cookies visible to the current page.

Returns:

A promise that will be resolved when all cookies have been deleted.

Type: 
Promise.<void>

deleteCookie(name) → (non-null) {Promise.<void>}

Deletes the cookie with the given name. This command is a no-op if there is no cookie with the given name visible to the current page.

Parameters:
NameTypeDescription
namestring

The name of the cookie to delete.

Returns:

A promise that will be resolved when the cookie has been deleted.

Type: 
Promise.<void>

(async) getCookie(name) → (non-null) {Promise.<?Options.Cookie>}

Retrieves the cookie with the given name. Returns null if there is no such cookie. The cookie will be returned as a JSON object as described by the WebDriver wire protocol.

Parameters:
NameTypeDescription
namestring

The name of the cookie to retrieve.

Throws:

if there is no such cookie.

Type
error.NoSuchCookieError
Returns:

A promise that will be resolved with the named cookie

Type: 
Promise.<?Options.Cookie>

getCookies() → (non-null) {Promise.<!Array.<!Options.Cookie>>}

Retrieves all cookies visible to the current page. Each cookie will be returned as a JSON object as described by the WebDriver wire protocol.

Returns:

A promise that will be resolved with the cookies visible to the current browsing context.

Type: 
Promise.<!Array.<!Options.Cookie>>

getTimeouts() → (non-null) {Promise.<{script: number, pageLoad: number, implicit: number}>}

Fetches the timeouts currently configured for the current session.

Returns:

A promise that will be resolved with the timeouts currently configured for the current session.

Type: 
Promise.<{script: number, pageLoad: number, implicit: number}>

logs() → (non-null) {Logs}

Returns:

The interface for managing driver logs.

Type: 
Logs

setTimeouts(conf) → (non-null) {Promise.<void>}

Sets the timeout durations associated with the current session.

The following timeouts are supported (all timeouts are specified in milliseconds):

  • implicit specifies the maximum amount of time to wait for an element locator to succeed when locating elements on the page. Defaults to 0 milliseconds.

  • pageLoad specifies the maximum amount of time to wait for a page to finishing loading. Defaults to 300000 milliseconds.

  • script specifies the maximum amount of time to wait for an evaluated script to run. If set to null, the script timeout will be indefinite. Defaults to 30000 milliseconds.

Parameters:
NameTypeDescription
confObject

The desired timeout configuration.

Throws:

if an invalid options object is provided.

Type
TypeError
Returns:

A promise that will be resolved when the timeouts have been set.

Type: 
Promise.<void>

window() → (non-null) {Window}

Returns:

The interface for managing the current window.

Type: 
Window