I have seen many examples for fetching the already stored data but didn't get any example for fetching the stored values.
Asked
Active
Viewed 2,298 times
5
-
check below answers. http://stackoverflow.com/questions/21960598/accessing-localstorage-in-protractor-test-for-angularjs-application – Irfan Ali Apr 06 '17 at 11:12
-
Thanks for your quick reply. I already go through to this link but there is no content regarding the storing of the values using protractor. – Shravan Jain Apr 06 '17 at 11:19
1 Answers
8
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');");

Stephane Janicaud
- 3,531
- 1
- 12
- 18
-
Thanks for quick reply. But this is for retrieval operation not for storing purpose. – Shravan Jain Apr 06 '17 at 11:53