Version
1.58.0
Steps to reproduce
- Clone the reproduction repo
npm install
npm test
- Observe the error:
bad option: --remote-debugging-port=0
Expected behavior
Electron app launches successfully and Playwright connects via CDP.
Actual behavior
Launch fails immediately with:
electron.launch: Process failed to launch!
Call log:
- <launching> .../Electron.app/Contents/MacOS/Electron --inspect=0 --remote-debugging-port=0 main.js
- [err] .../Electron.app/Contents/MacOS/Electron: bad option: --remote-debugging-port=0
The Electron binary rejects --remote-debugging-port=0 as an invalid CLI argument before any JavaScript executes.
Root cause: Playwright passes --remote-debugging-port=0 as a CLI argument, but Electron 30+ rejects this flag at the CLI level before the Node.js script starts.
Tested with both Playwright 1.57.0 and 1.58.0 - same issue.
Additional context
- Electron docs list
--remote-debugging-port as supported, but it only works via app.commandLine.appendSwitch() in Electron 30+, not as a CLI argument
- This affects both the npm electron package and custom executablePath configurations
- The
nodeCliInspect fuse documentation doesn't mention --remote-debugging-port being affected
- Workarounds attempted (all failed):
- Pass flag after script path with
-- → Flag ignored
- Environment variable +
app.commandLine.appendSwitch() in app → app.commandLine undefined due to ES module hoisting
- Playwright's
loader.js preload → Never executes because Electron rejects the flag first
- Cypress documented similar issues: cypress-io/cypress#7994
Environment
System:
OS: macOS 15.6.1
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 160.07 MB / 16.00 GB
Binaries:
Node: 20.19.6 - /node/20.19.6/bin/node
Yarn: 4.12.0 - /yarn/4.12.0/bin/yarn
npm: 10.8.2 - /node/20.19.6/bin/npm
npmPackages:
@playwright/test: 1.58.0
electron: 36.9.5
Version
1.58.0
Steps to reproduce
npm installnpm testbad option: --remote-debugging-port=0Expected behavior
Electron app launches successfully and Playwright connects via CDP.
Actual behavior
Launch fails immediately with:
The Electron binary rejects
--remote-debugging-port=0as an invalid CLI argument before any JavaScript executes.Root cause: Playwright passes
--remote-debugging-port=0as a CLI argument, but Electron 30+ rejects this flag at the CLI level before the Node.js script starts.Tested with both Playwright 1.57.0 and 1.58.0 - same issue.
Additional context
--remote-debugging-portas supported, but it only works viaapp.commandLine.appendSwitch()in Electron 30+, not as a CLI argumentnodeCliInspect fuse documentation doesn't mention--remote-debugging-portbeing affected--→ Flag ignoredapp.commandLine.appendSwitch()in app → app.commandLine undefined due to ES module hoistingloader.jspreload → Never executes because Electron rejects the flag firstEnvironment