Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to store local storage data using Protractor?

I have seen many examples for fetching the already stored data but didn't get any example for fetching the stored values.

like image 768
Shravan Jain Avatar asked Apr 06 '17 11:04

Shravan Jain


People also ask

What method is used to store a value in local or session storage?

Storage setItem() Method The setItem() method sets the value of the specified Storage Object item. The setItem() method belongs to the Storage Object, which can be either a localStorage object or a sessionStorage object.

How do you store a protractor?

Storage. When the mitre saw protractor is not in use, place it in a safe place to avoid any damage. Leather holsters are available so mitre saw protractors can be stored away and protected. Located on the bottom of each arm of a mitre saw protractor are holes that can be used to hang the protractors on a nail or string ...


1 Answers

You can access localStorage through browser.executeScript() this way:

Get value

var value = browser.executeScript("return window.localStorage.getItem('myKey');");

Set value

browser.executeScript("window.localStorage.setItem('myKey', 'myValue');");
like image 105
Stephane Janicaud Avatar answered Sep 29 '22 20:09

Stephane Janicaud