Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

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

fmaiing0c45dfc773fe
diff --git a/packages/playwright-core/src/server/utils/processLauncher.ts b/packages/playwright-core/src/server/utils/processLauncher.ts
index 6c491d0f48..58f2db795b 100644
--- a/packages/playwright-core/src/server/utils/processLauncher.ts
+++ b/packages/playwright-core/src/server/utils/processLauncher.ts
@@ -136,6 +136,7 @@ export async function launchProcess(options: LaunchProcessOptions): Promise<Laun
// process group, making it possible to kill child process tree with `.kill(-pid)` command.
// @see https://nodejs.org/api/child_process.html#child_process_options_detached
detached: process.platform !== 'win32',
+ windowsHide: true,
env: options.env,
cwd: options.cwd,
shell: options.shell,
@@ -233,7 +234,7 @@ export async function launchProcess(options: LaunchProcessOptions): Promise<Laun
// Force kill the browser.
try {
if (process.platform === 'win32') {
- const taskkillProcess = childProcess.spawnSync(`taskkill /pid ${spawnedProcess.pid} /T /F`, { shell: true });
+ const taskkillProcess = childProcess.spawnSync(`taskkill /pid ${spawnedProcess.pid} /T /F`, { shell: true, windowsHide: true });
const [stdout, stderr] = [taskkillProcess.stdout.toString(), taskkillProcess.stderr.toString()];
if (stdout)
options.log(`[pid=${spawnedProcess.pid}] taskkill stdout: ${stdout}`);