Is there a way to get the JWT Token inside the LocalStorage of the Browser using Robot Framework?

Hi Nyx,

  1. If your lucky the JWT is passed by a cookie in which case Get Cookie or Get Cookies will get you what you need.

  2. another option if the JWT is passed as a http header then you will probably need to work with some javascript to extract it, Execute Javascript will be useful to do this.
    Here is some Javascript that I modified from some examples I found regarding getting headers from a page, it basically triggers the browser to send a HTTP HEAD request for the current page and then extracts the headers from that HEAD request

var req = new XMLHttpRequest();'HEAD', document.location, false);
var headrs = req.getAllResponseHeaders().split("\n");
  1. yet another option is to use the javascript functions for accessing the storage locations, i’ve never done this myself, but I found some documentation on it here JavaScript localStorage - GeeksforGeeks, combine that with Execute Javascript and you might be able to query that storage location directly

Hope this helps,


Thank you so much highly appreciated, i’ll get look into your suggestions @damies13

1 Like

Hello @damies13 I’ve found a library where you can easily get an item on the localStorage or sessionStorage

Screenshot from 2022-10-14 15-50-05

1 Like