Browser rendering support localstorage API?

I am testing a page with multiple languages ​and that requires a session, this data is saved in local storage, but it seems that it is not working.
const page = await browser.newPage();
await page.goto(body.url,{
waitUntil:body.waitUntil??"domcontentloaded",
timeout:0
});

if(body.localStorage){
await page.evaluateOnNewDocument((session)=>{

localStorage.setItem("session",session)
localStorage.setItem("lang","en")

},"nfjewfweguwgbwerbgwhgwuye")
}
const html = await page.content();
await page.close();
await browser.disconnect();
Was this page helpful?