← Back to Discord Forum


bosniankicksposted in #help-playwright
Open in Discord

I am using playwright with an electron application. Utilizing Electron-Forge to build the EXE, but we need the user to have the npx playwright install command ran to run the browser binaries to be installed. Is there a way to do this? The application is fully finished and is running an automation on a work website, in which I cant really give much source code besides my main.js file and some playwright stuff. Is there any way to do run something that can bundle a chromium install or that we can have the users run from node to make the application work?

This thread is trying to answer question "Is there a way to run the 'npx playwright install' command or bundle a Chromium install for an Electron application built using Electron-Forge?"

0 replies


Sure, you can use Playwright to automate an Electron app built with Electron-Forge. First, initialize Playwright in your project with npm init playwright@latest. This sets up the necessary files like playwright.config.ts, package.json, and package-lock.json.

Then, you can run npx playwright install to download and install the default browsers supported by Playwright.

If you want to bundle a Chromium installation for your Electron app, you can use Playwright's ability to operate against branded Google Chrome and Microsoft Edge browsers available on your machine.

Here's how you can define configurations in your playwright.config.ts file to use Google Chrome or Microsoft Edge:

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

export default defineConfig({
  projects: [
      name: 'Google Chrome',
      use: {
        browserName: 'chromium',
        channel: 'chrome'
      name: 'Microsoft Edge',
      use: {
        browserName: 'chromium',
        channel: 'msedge'

Remember, Playwright doesn't install Google Chrome or Microsoft Edge by default. If they're not available on your machine, you can use the Playwright command line tool to install them. For instance, npx playwright install msedge installs Microsoft Edge. But be careful, as it will override your current browser installation and install them at the default global location of your operating system.

In short, you can either run npx playwright install to download and install the default browsers supported by Playwright, or leverage existing installations of Google Chrome or Microsoft Edge by configuring Playwright in your playwright.config.ts file.

Related Discord Threads

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 luc@ray.run.