WebPagetest Forums

Full Version: Setting localstorage values
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello all
I am a novice to the WPT and I would like to know if there is a way to set localstorage in the browser session that loads the page
Right now I have the script like this but it is not taking any effect


setCookie xxx.xxx.com split_tcv=200
setCookie xxx.xxx.com __vst=d991880c-d603-41cb-b4ff-d6d11c8fd8b5
exec localStorage.setItem('recently_viewed', '1130217481,2267432533,1497137951,2441643263,1581060853,2267909440');
navigate https://XXX.XXX.com

I also tried
setCookie xxx.xxx.com split_tcv=200
setCookie xxx.xxx.com __vst=d991880c-d603-41cb-b4ff-d6d11c8fd8b5
exec window.localStorage.setItem('recently_viewed', '1130217481,2267432533,1497137951,2441643263,1581060853,2267909440');
navigate https://XXX.XXX.com
You have to be on a page on the domain your are trying to write localstorage to before it will work. If you have a blank page you can host on the domain that would be best. There is no way to pre-populate the local storage before running a first-view test.
Thanks @pmeenan.
After I added another domain page navigation it is setting up local storage with intended values.
Reference URL's