通过Puppeteer设置SessionStorage

问题描述 投票:0回答:1

我正在使用木偶戏去抓屏幕。但是,要加载所需页面,需要在SessionStorage(浏览器页面)中设置上下文。到目前为止,我无法做到这一点。任何帮助,将不胜感激!。

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

node.js browser screen-scraping google-chrome-headless session-storage
1个回答
0
投票

难道不能这样的工作吗?

        await page.goto(url);
        await page.evaluate(() => {
            sessionStorage.setItem(...);
        });
© www.soinside.com 2019 - 2024. All rights reserved.