Skip to content

[Bug]: Timeout on electron.launch when not loading any file or URL in the main window #29386

Open
@dabo248

Description

@dabo248

Version

1.41.1

Steps to reproduce

  1. Clone my repo at https://github.com/dabo248/electron-playwright-issue
  2. Run the following commands:
npm install
npm run build
npx playwright test

Expected behavior

I expect the example test to succeed without setting any URL or file to the main window. Only if I load an URL (or file) with the BrowserWindow it works. See main.js for this workaround.

Actual behavior

Playwright's electron.launch does not return and the test runs into a timeout.

I was able to track it down to _waitForAllPagesToBeInitialized not returning for the main window because of Emulation.setFocusEmulationEnabled not receiving a response.

When running the test with DEBUG=pw:protocol npx playwright test you can see a response for the browser view ("id":11), but not for the browser window ("id":22):

pw:protocol SEND ► {"id":11,"method":"Emulation.setFocusEmulationEnabled","params":{"enabled":true},"sessionId":"8D031A3EF58E25A9CCF2354E0C8F467E"} +1ms

[...]

pw:protocol ◀ RECV {"id":11,"result":{},"sessionId":"8D031A3EF58E25A9CCF2354E0C8F467E"} +0ms

[...]

pw:protocol SEND ► {"id":22,"method":"Emulation.setFocusEmulationEnabled","params":{"enabled":true},"sessionId":"D8169FB4EE16A5D0A8366C326B7FACC6"} +1ms

Additional context

I first experienced this issue when switching from Electron 24.1.0 to 27.1.2 without changing the Playwright version.

Environment

System:
    OS: Linux 6.5 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
    CPU: (4) x64 QEMU Virtual CPU version 2.5+
    Memory: 12.71 GB / 15.61 GB
    Container: Yes
  Binaries:
    Node: 18.15.0 - ~/.nvm/versions/node/v18.15.0/bin/node
    npm: 9.5.0 - ~/.nvm/versions/node/v18.15.0/bin/npm
  Languages:
    Bash: 5.1.16 - /usr/bin/bash
  npmPackages:
    @playwright/test: ^1.41.1 => 1.41.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions