I am looking for a way to save items from local storage using C# (via JS, as there doesn't seem to be a solution with pure C#). I quickly tried the following code:
public string token;
string storageToken = "localStorage.getItem('token')";
token = (string)js.ExecuteScript(storageToken);`
However, when I run this code, it returns an empty string for these elements. My goal is to retrieve local storage elements, store them in variables, and then use them in another method:
string tokenSetItemScript = $"localStorage.setItem('token','{token}')";
js.ExecuteScript(tokenSetItemScript);