我尝试使用page.evaluate
,但chrome.storage
似乎是undefined
:
const targets = await browser.targets();
const backgroundPageTarget = targets.find(target => target.type() === 'background_page');
const backgroundPage = await backgroundPageTarget.page();
...
const test = await backgroundPage.evaluate(() => {
return Promise.resolve(chrome.storage);
});
您知道如何使用Puppeteer访问chrome.storage
吗?