Set a cookie, specified as a cookie JSON object, as defined here.

Uses cookie protocol command.

Usage

.setCookie(cookie, [callback])

Parameters

Name Type description
cookie object

The cookie object.

callback
Optional
function

Optional callback function to be called when the command finishes.

Example

this.demoTest = function(browser) {
  browser.setCookie({
    name     : "test_cookie",
    value    : "test_value",
    path     : "/", (Optional)
    domain   : "example.org", (Optional)
    secure   : false, (Optional)
    httpOnly : false, // (Optional)
    expiry   : 1395002765 // (Optional) time in seconds since midnight, January 1, 1970 UTC
  });
}

See also