const playwright = require("playwright");
(async () => {
for (const browserType of ["chromium", "firefox", "webkit"]) {
const browser = await playwright[browserType].launch();
const context = await browser.newContext();
const page = await context.newPage('https://google.com/');
await page.screenshot({ path: `example-${browserType}.png` });
}
})();
我试图运行这个片段。它按预期从 Chromium 和 Firefox 中截取屏幕截图。但是当它尝试从 webkit 截取屏幕截图时会引发超时错误。虽然,local-webkit 是与 playwright 一起安装的。