How to store local storage data using Protractor?
Asked Answered
A

1

5

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

Anaclitic answered 6/4, 2017 at 11:5 Comment(2)
check below answers. #21961098Centurial
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.Anaclitic
W
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');");
Witherite answered 6/4, 2017 at 11:50 Comment(1)
Thanks for quick reply. But this is for retrieval operation not for storing purpose.Anaclitic

© 2022 - 2024 — McMap. All rights reserved.