Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setLocalStorageItem(key, value) Example #3

Open
cpeople2 opened this issue Nov 6, 2018 · 2 comments
Open

setLocalStorageItem(key, value) Example #3

cpeople2 opened this issue Nov 6, 2018 · 2 comments

Comments

@cpeople2
Copy link

cpeople2 commented Nov 6, 2018

Hello, can you please provide an example of how and where to setLocalStorageItem(key, value) within the code? I am unable to setLocalStorage with my token and have tried many different ways to no avail. Your response is very much appreciated. Thanks!

@vvedachalam
Copy link

//set the local storage Key , value
let setLocalStorage = ClientFunction(() => localStorage.setItem('access_token', 'aaa')).with({ boundTestRun: testController });
// retrieve the local storage value - This may not be required but just for demo to output the stored val
let getLocalStorage = ClientFunction(() => localStorage.getItem('access_token')).with({ boundTestRun: testController });
// before storing the value, you need to reach some page of the site
await testController.navigateTo('www'testsite.com/images/1.gif');
await setLocalStorage();
console.log('The cookie set is: ' + await getLocalStorage());

@vvedachalam
Copy link

@cpeople2 Any luck?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants