Skip to content

fix(windows): hide console window when spawning browser processes#38776

Merged
yury-s merged 1 commit intomicrosoft:mainfrom
fmaiing:main
Feb 24, 2026
Merged

fix(windows): hide console window when spawning browser processes#38776
yury-s merged 1 commit intomicrosoft:mainfrom
fmaiing:main

Conversation

@fmaiing
Copy link
Copy Markdown
Contributor

@fmaiing fmaiing commented Jan 14, 2026

Description:

Problem

On Windows, running Playwright in headless mode shows a visible console window for chrome-headless-shell.exe. Additionally, when closing the browser, a taskkill command window briefly flashes.

This happens because child_process.spawn() and spawnSync() don't set windowsHide: true.

Solution

Add windowsHide: true to:

  1. spawnOptions in launchProcess() - hides the browser console window
  2. taskkill spawnSync call - hides the kill command window

Testing

Tested on Windows 11 with Playwright 1.57.0 running chromium in headless mode.

Before: Console window visible during entire browser session
After: No console window appears

Fixes: #39335

On Windows, spawning chrome-headless-shell.exe and taskkill commands creates visible console windows. This adds windowsHide: true to child_process.spawn() and spawnSync() options to hide these windows.

Fixes console window appearing during headless browser operation on Windows.

Signed-off-by: fmaiing <tooold@gmail.com>
@Skn0tt
Copy link
Copy Markdown
Member

Skn0tt commented Jan 14, 2026

Hi, thanks for taking the time to open a PR. Could you open an issue where we can discuss the underlying issue first? This touches the very core of the project, so every change is critical.

@yury-s
Copy link
Copy Markdown
Member

yury-s commented Feb 24, 2026

Linking it to #39335

@github-actions
Copy link
Copy Markdown
Contributor

Test results for "tests 1"

6 flaky ⚠️ [chromium-page] › page/page-request-continue.spec.ts:754 › propagate headers cross origin redirect after interception `@chromium-ubuntu-22.04-node20`
⚠️ [firefox-library] › library/inspector/cli-codegen-1.spec.ts:1082 › cli codegen › should not throw csp directive violation errors `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-page] › page/page-wait-for-function.spec.ts:104 › should work with strict CSP policy `@firefox-ubuntu-22.04-node20`
⚠️ [webkit-page] › page/page-set-input-files.spec.ts:38 › should upload a folder `@webkit-ubuntu-22.04-node20`
⚠️ [playwright-test] › ui-mode-trace.spec.ts:433 › should work behind reverse proxy `@macos-latest-node20`
⚠️ [playwright-test] › ui-mode-trace.spec.ts:812 › should update state on subsequent run `@windows-latest-node20`

37552 passed, 838 skipped


Merge workflow run.

@yury-s yury-s merged commit 0c45dfc into microsoft:main Feb 24, 2026
29 of 34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Hide cmd window that spawns and hides

4 participants