playwright错误:UnhandledPromiseRejectionWarning:TimeoutError:等待firstPage代理失败:超时超过30000ms

问题描述 投票:1回答:1
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一起安装。

javascript playwright
1个回答
0
投票

我也是。在我的本地MacBook和Github Actions Mac上都会发生这种情况

((node:2686)UnhandledPromiseRejectionWarning:TimeoutError:等待firstPageProxy失败:超时超过30000ms在Function.waitWithTimeout(/home/runner/work/z_polytest_proto/z_polytest_proto/node_modules/playwright-core/lib/helper.js:120:30)在WKBrowser._waitForFirstPageTarget(/home/runner/work/z_polytest_proto/z_polytest_proto/node_modules/playwright-core/lib/webkit/wkBrowser.js:72:31)在Function.connect(/home/runner/work/z_polytest_proto/z_polytest_proto/node_modules/playwright-core/lib/webkit/wkBrowser.js:46:23)在异步WebKit.launch(/home/runner/work/z_polytest_proto/z_polytest_proto/node_modules/playwright-core/lib/server/webkit.js:44:25)在异步/home/runner/work/z_polytest_proto/z_polytest_proto/src/js/instance.js:20:21(节点:2686)UnhandledPromiseRejectionWarning:未处理的承诺拒绝。引发此错误的原因可能是抛出了一个没有catch块的异步函数,或者是拒绝了一个没有使用.catch()处理的promise。 (拒绝ID:1)(节点:2686)[DEP0018] DeprecationWarning:已弃用未处理的承诺拒绝。将来,未处理的承诺拒绝将以非零退出代码终止Node.js进程。

© www.soinside.com 2019 - 2024. All rights reserved.