Skip to content
A taiko plugin to interact with browser storages
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/workflows Rename workflow Sep 9, 2019
assets Taiko plugin for local and session storage. Sep 9, 2019
src Adding descriptions for action. Sep 11, 2019
LICENSE Taiko plugin for local and session storage. Sep 9, 2019 Update Sep 16, 2019
package.json Fix taiko dep version. Sep 16, 2019

Taiko Storage

npm version Actions Status


A taiko plugin to interact with browser storages (localStorage and sessionStorage).


  • npm install taiko-storage --save


const { openBrowser, closeBrowser, click, storage: { localStorage, sessionStorage} } = require('taiko');


const { openBrowser, closeBrowser, click, storage } = require('taiko');
const {localStorage, sessionStorage} = storage;


(async () => {
    try {
        await openBrowser();
        await localStorage.setItem("Key", "Value");
        let value = await localStorage.getItem("Key");
        // more actions
        // ...
    } finally {
        await closeBrowser();


The plugin exposes two variables localStorage and sessionStorage which represents to the respective storages. The APIs for both the storage are same and try to very close the the native storage apis.

setItem(key, value)

set the given key value to storage

await localStorage.setItem(key, value);
// or
await sessionStorage.setItem(key, value);


featch the value for given key from storage

await localStorage.getItem(key);
// or
await sessionStorage.getItem(key);


validate if the given key exists in storage.

await localStorage.hasItem(key);
// or
await sessionStorage.hasItem(key);


remove the item with given key from the storage.

await localStorage.removeItem(key);
// or
await sessionStorage.removeItem(key);


clear the stoarage

await localStorage.clear();
// or
await sessionStorage.clear();


tell the no of items in storage.

await localStorage.length();
// or
await sessionStorage.length();

Use in Taiko REPL

To launch the REPL type taiko --plugin taiko-storage in your favorite terminal application. This will launch the Taiko Prompt.

e.g Version: 0.7.0 (Chromium:74.0.3723.0) Type .api for help and .exit to quit

You should now have full access to localStorage and sessionStorage apis in the taiko REPL window

You can’t perform that action at this time.