View Source Improve this doc

getCookie

Retrieve a cookie visible to the current page. You can query a specific cookie by providing the cookie name or retrieve all.

Usage

1
browser.getCookie([name]);

Parameters

Param Type Details
name
optional
String name of requested cookie

Example

getCookie.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
it('should return a cookie for me', function () {
browser.setCookie({name: 'test', value: '123'})
browser.setCookie({name: 'test2', value: '456'})
var testCookie = browser.getCookie('test')
console.log(testCookie); // outputs: { name: 'test', value: '123' }
var allCookies = browser.getCookie()
console.log(allCookies);
// outputs:
// [
// { name: 'test', value: '123' },
// { name: 'test2', value: '456' }
// ]
})

Uses