Set SessionStorage through Puppeteer

Viewed 3188

I am using puppeteer to take a screen grab. To load the required page however, a context needs to be set in the SessionStorage (of the browser page). I am not able to do achieve that as of now. Any help would be appreciated!.

browser.newPage().then(Page => { //maybe set some context here so that the page can access the context from sessionStorage page.goto(url).then( .....)})

1 Answers

Couldn't something like this work?

        await page.goto(url);
        await page.evaluate(() => {
            sessionStorage.setItem(...);
        });
Related