View Source Improve this doc

cookie

Protocol binding to operate with cookies on the current page.

Usage

1
2
browser.cookie([method][,args]);

Parameters

Param Type Details
method
optional
String request method
args
optional
Object/String= contains cookie information if you want to set a cookie or contains name of cookie if you want to delete it

Example

cookie.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
it('should get/set cookies using protocol command', function () {
// get all cookies
var cookies = browser.cookie();
console.log(cookies); // outputs: [{ name: 'test', value: '123' }]
// set cookie
browser.cookie('post', {
name: 'myCookie',
value: 'some content'
});
// delete cookie (sync)
browser.cookie('delete','myCookie');
})

Returns

  • <Object>: cookie data