How to specify browser flags for Playwright component tests?

113 views Asked by At

In a Playwright component test, is there a way to pass flags to the browser instance that gets run? For example, for Chrome: --use-fake-ui-for-media-stream, --use-file-for-fake-audio-capture, and similar.

1

There are 1 answers

0
candre On BEST ANSWER

Add launchoptions to the project in playwright.config:

export default defineConfig({
  // ..
  projects: [
    {
      name: "Chrome",
      use: {
        browserName: "chromium",
        launchOptions: {
          args: [
            "--use-fake-ui-for-media-stream",
            "--use-file-for-fake-audio-capture",
          ],
        },
      },
    },
  ],
});