Rayrun
← Back to Discord Forum

The chromium windows keep popping up on Windows

I've recently switched from Mac to Windows, and now when running my Playwright test suite the chromium.exe console window keeps opening even if my tests are headless. This is very annoying, on Mac I could run the tests in background and do whatever I like, but now I'm getting interrupted by these windows. Is it expected behavior? Can I do something aobut it?

image.png

This thread is trying to answer question "Is it expected for the chromium.exe console window to keep opening while running Playwright tests in headless mode on Windows, and if not, how can this be prevented?"

1 reply

Here's my taskbar when running the suite with xdist to parallelize it:

image.png

Answer

Controlling Chromium Console Window in Playwright Tests

Yes, it's normal for the chromium.exe console window to pop up when you're running Playwright tests in headless mode on Windows. This is because it's responsible for launching and controlling the headless Chromium browser.

Configuring Playwright

You can prevent this by tweaking your playwright.config.ts file. Here, you can set various test execution settings. For instance, you can change the number of workers used for test execution. By default, Playwright uses 3 workers. You can change this to use just one worker:

import { PlaywrightTestConfig } from '@playwright/test';

const config: PlaywrightTestConfig = {
  workers: 1,
};

export default config;

You can also set environment variables visible to the browser using the "env" option:

const config: PlaywrightTestConfig = {
  env: {
    MY_ENV_VAR: 'value',
  },
};

Using Command Line Flags

Another way to control this is by using specific command line flags when running your tests. For example, you can use the --headed flag instead of --headless to run your tests in headed mode. This will open a browser window during test execution.

UI Mode

For more control during debugging or development, consider using Playwright's UI Mode. This enables features like time travel debugging and watch mode, enhancing your developer experience.

In short, while the chromium.exe console window appearing is normal, there are several ways to prevent or customize this, such as modifying the worker count in the playwright.config.ts file or using specific command line flags. Plus, UI Mode gives you more control and a better developer experience during test execution.

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].