const playwright = require("playwright");
(async () => {
const browsers = ["chromium", "firefox", "webkit"];
for (const browserType of browsers) {
const browser = await playwright[browserType].launch({args: ['--no-sandbox']});
const context = await browser.newContext();
const page = await context.newPage("http://whatsmyuseragent.org/");
await page.screenshot({ path: `example-${browserType}.png` });
}
})();
运行此脚本后,我得到 UnhandledPromiseRejectionWarning: Error: Firefox 修订版未下载。在控制台中运行“npm install”或“yarn install”。如何解决?