View Source Improve this doc

localStorage

Protocol bindings for all localStorage operations. This command is not part of the official Webdriver specification and might not be supported for your browser.

Usage

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

Parameters

Param Type Details
method String method for storage operation
args
optional
Object/String operation arguments

Example

localStorage.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
it('should set/receive values from local storage', function () {
// get the storage item for the given key
var values = browser.localStorage('GET', someKey);
// get all key/value pairs of the storage
var storage = browser.localStorage();
// set the storage item for the given key
browser.localStorage('POST', {key: someKey, value: someValue});
// remove the storage item for the given key
browser.localStorage('DELETE', 'someKey');
// clear the storage
browser.localStorage('DELETE');
});