deleteCookie

Delete cookies visible to the current page. By providing a cookie name it just removes the single cookie.

Usage

1
browser.deleteCookie([name]);

Parameters

Param Type Details
name
optional
String name of cookie to be deleted

Example

deleteCookie.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
it('should delete cookies', function () {
browser.setCookie({name: 'test', value: '123'})
browser.setCookie({name: 'test2', value: '456'})
browser.setCookie({name: 'test3', value: '789'})

var cookies = browser.getCookie()
console.log(cookies)
// outputs:
// [
// { name: 'test', value: '123' },
// { name: 'test2', value: '456' }
// { name: 'test3', value: '789' }
// ]

browser.deleteCookie('test3')
cookies = browser.getCookie()
console.log(cookies)
// outputs:
// [
// { name: 'test', value: '123' },
// { name: 'test2', value: '456' }
// ]

browser.deleteCookie()
cookies = browser.getCookie()
console.log(cookies) // outputs: []
})

Uses