microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
66.51k stars 3.64k forks source link

Electron: electronApplication.firstWindow: Timeout 30000ms exceeded while waiting for event "window" #19796

Closed laxmareddy1819 closed 1 year ago

laxmareddy1819 commented 1 year ago

Context:

Playwright Version: 1.20.0 Operating System: Mac OS Ventura Node.js version: v12.13.0 Electron Version: 7.1.11

Issue: Getting Timeout issue at electronApp.firstWindow(); after launching Electron application. Electron application launched successfully.

Following is the error:

(node:4860) UnhandledPromiseRejectionWarning: electronApplication.firstWindow: Timeout 30000ms exceeded while waiting for event "window" at /Users/../Desktop/Code/../../test/codeapp.spec.js:44:34 (node:4860) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:4860) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Code Snippet:

const electronApp = await electron.launch({
    args: [
      '/Users/../Desktop/../../../app/main.js'
      ]
  });

 // Evaluation expression in the Electron context.
  const appPath = await electronApp.evaluate(async ({ app }) => {
    return app.getAppPath();
  });
  console.log(appPath);

  const page = await electronApp.firstWindow();

Please check and provide the solution for above issue.

aslushnikov commented 1 year ago

@laxmareddy1819 I see you use Playwright 1.20; could you please try Playwright 1.29.1? There were some fixes that might help you.

laxmareddy1819 commented 1 year ago

@aslushnikov Playwright 1.29.1 is not compatible with Node.js version: v12.13.0 .

Can you provide any other alternative solution

aslushnikov commented 1 year ago

@laxmareddy1819 We don't back-port fixes to the old versions. The best I can recommend is updating node.js to LTS so that you could use latest-and-greatest Playwright.