Retrieve a single cookie visible to the current page. The cookie is returned as a cookie JSON object, as defined here.

Uses cookie protocol command.

Usage

                    .getCookie(name, [callback])
                

Example

this.demoTest = function(browser) {
  browser.getCookie(name, function callback(result) {
    this.assert.equal(result.value, '123456');
    this.assert.equal(result.name, 'test_cookie');
  });
}

Parameters

Name Type description
name string

The cookie name.

callback function

Callback function which is called with the result value.

Returns

Type description
object | null

The cookie object as a selenium cookie JSON object or null if the cookie wasn't found.

See also