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` });
}
})();
我尝试运行此代码段。如预期的那样,需要截取铬和Firefox的屏幕截图。但是尝试从Webkit截屏时会引发超时错误。但是,local-webkit随playwright一起安装。