TestProject Forum

Output Input "state" via Project Parameter

Hello community

I need to retrieve a session after logout for a next test. Therefor I’m trying to get the state (or state.token) from local storage and write in to a Project Parameter. I use “retrieve item xy from local storage”.

My problem is, that I don’t get the value (which must be the whole object “state”) in my Project Parameter. The field remains empty and it looks like its capable to store simple values only?

Some help or hints would be appreciated. I’m pretty much stuck :slight_smile:

Hi @Andrew
If you want to get all session storage and not just the value of the key you can use the action execute JavaScript and execute this commend - return window.sessionStorage;

Also there is a different solution for that you can execute your jobs with a chrome profile where the previous state is already saved automatically

Please let me know if that solved your issue.

Hi @Tal.Efraim

Thank you very much for your kind response.

I tried the JavaScript command, respectively adapted it slightly: return window.localStorage.getItem(‘state’);

This seems to extract the whole local storage - good so far. But in the following (separated) test I try to retrieve the data with “Set value for item in local storage” but there’s no current value in the project parameter (EMPTY).

I was able to retrieve and set local storage within the same test. But not retrieve it in one test and set it in the next test.

Any thoughts on this?

Thank you in advance