DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
Redmond desk6 min

How to Fix Playwright Browser Closed Errors With Microsoft Edge

A Playwright browser-closed message may be a downstream symptom. Trace the first failure, verify the msedge channel, and check lifecycle, profiles, launch settings, policies, and CI setup.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A Playwright “browser closed” error with Microsoft Edge is often the final symptom, not the original cause. First use Playwright’s supported msedge channel, then identify whether the first failure happens at launch, context creation, navigation, or cleanup. Check the full log or trace before changing flags or reinstalling anything.

Start with Playwright’s supported Edge channel

Playwright uses Chromium automation to control Microsoft Edge. Select the documented msedge channel instead of guessing an Edge executable path. Edge Stable and Beta are supported channels, but Playwright says it works best with its bundled Chromium and does not guarantee compatibility with other Chromium versions. Branded Edge is not installed by Playwright by default, so install Edge separately if it is not already present.

In Playwright Test, configure the browser project with the Edge channel:

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

export default defineConfig({
  projects: [
    {
      name: 'Microsoft Edge',
      use: {
        browserName: 'chromium',
        channel: 'msedge',
      },
    },
  ],
});

For a direct launch in Node.js:

import { chromium } from 'playwright';

const browser = await chromium.launch({ channel: 'msedge' });
const page = await browser.newPage();
await page.goto('https://example.com');
console.log(await page.title());
await browser.close();

Use the equivalent channel: "msedge" launch option in other Playwright language bindings. See the Playwright browser guide and BrowserType API documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Microsoft Surface Laptop 5 13.5” Touch-Screen – Intel Core i7-16GB - 256GB SSD Windows 11 PRO (Latest Model) - Matte Black (Renewed)
  • Microsoft Surface Laptop 5 13.5" | Certified Refurbished, Amazon Renewed | Microsoft Surface Laptop 5 features 12th generation Intel Core i7-1265U processor, 13.5-inch PixelSense Touchscreen Display (2256 x 1504) resolution
  • This Certified Refurbished product is tested and certified to look and work like new. The refurbishing process includes functionality testing, basic cleaning, inspection, and repackaging. The product ships with all relevant accessories, a minimum 90-day warranty, and may arrive in a generic box.
  • 256GB Solid State Drive, 16GB RAM, Convenient security with Windows Hello sign-in, plus Fingerprint Power Button with Windows Hello and One Touch sign-in on select models., Integrated Intel UHD Graphics
  • Surface Laptop 5 for Business 13.5” & 15”: Wi-Fi 6: 802.11ax compatible Bluetooth Footnote Wireless 5.0 technology, Surface Laptop 4 for Business 15” in Platinum and Matte Black metal: 3.40 lb
  • 1 x USB-C 1 x USB-A 3.5 mm headphone jack 1 x Surface Connect port

Find the first failure, not just the closure message

A “browser has been closed” report can follow a launch failure, a browser crash, or an intentional close. Record the Playwright version, Edge channel and version, operating system, language binding, and whether the error occurs during launch, context creation, navigation, or after a test action. Preserve the complete local or CI output; the first error usually narrows the cause more than the later closure message.

For Playwright Test, enable browser diagnostics when investigating a launch failure:

DEBUG=pw:browser npx playwright test

On Windows PowerShell, set the environment variable for that invocation with $env:DEBUG="pw:browser"; npx playwright test. The Playwright CI guide identifies pw:browser output as useful for “Failed to launch browser” errors. If the failure is intermittent, retain the trace and the complete output from both failing and successful runs.

Rank #2
Microsoft Surface Laptop 4 15” Touch-Screen – Intel Core i7 - 32GB - 1TB Solid State Drive - Matte Black
  • Power to do what you want with up to 70% more speed than before and an 11th Gen Intel Core processor.
  • Thin, light, elegant design in choice of two sizes: light, portable 13.5” or larger 15” that’s perfect for split-screen multitasking.
  • Show your best side on video calls with sharp video and image quality, even in low light, thanks to a front-facing 720p HD camera.
  • Enjoy theater-like sound for movies and shows with Omnisonic Speakers backed by immersive Dolby Atmos6.
  • Be heard loud and clear on calls with dual far-field Studio Mics that capture your voice and reduce background noise.

Check for an early or unintended close

Search test code, fixtures, and teardown hooks for browser.close() and context.close(). A cleanup routine that runs before navigation or assertions finish can make a later operation report that the browser is closed. In particular, closing a persistent context also closes its browser. Check that asynchronous setup and test work are awaited before teardown proceeds.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If you launch a persistent context, give automation its own user-data directory. Do not run simultaneous browser instances against the same directory: browsers do not allow multiple instances to share it. Avoid pointing automation at your everyday Edge profile; a dedicated profile avoids collisions with a normal browsing session and its existing state.

Temporarily remove custom launch settings

Return to the supported msedge channel and default launch behavior before changing flags. Playwright warns that custom browser arguments can break its functionality, and using a custom executable is at your own risk. If a custom argument or executable is genuinely required, add back one change at a time and capture the resulting launch output so you can identify which change triggers the failure.

Rank #3
Microsoft System Builder | Windоws 11 Home | Intended use for new systems | Install on a new PC | Branded by Microsoft
  • STREAMLINED & INTUITIVE UI, DVD FORMAT | Intelligent desktop | Personalize your experience for simpler efficiency | Powerful security built-in and enabled.
  • OEM IS TO BE INSTALLED ON A NEW PC with no prior version of Windows installed and cannot be transferred to another machine.
  • OEM DOES NOT PROVIDE SUPPORT | To acquire product with Microsoft support, obtain the full packaged “Retail” version.
  • PRODUCT SHIPS IN PLAIN ENVELOPE | Activation key is located under scratch-off area on label.
  • GENUINE WINDOWS SOFTWARE IS BRANDED BY MIRCOSOFT ONLY.

Do not treat an alternate executable path or a collection of Chromium flags as a general browser-closed fix. A custom path may select an unsupported or mismatched browser build, while custom flags can interfere with Playwright’s expected browser setup.

Compare managed, headed, headless, and CI runs

Organization-managed Edge

Enterprise browser policies can affect Playwright’s ability to launch or control Edge. The Playwright Browsers guide explicitly notes that certain Enterprise Browser Policies may have this impact. If the failure occurs only on a managed device, ask the administrator whether browser policy restricts automation. Playwright documents policy-managed environments as outside the project’s scope; changing Playwright code may not resolve a restriction imposed by organization policy.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Headed versus headless

Where the environment allows it, compare a headed run with a headless run while keeping the browser channel and test constant. Edge’s newer headless mode is closer to headed behavior and differs from the Chromium headless shell Playwright uses by default, so the two modes can behave differently. A failure isolated to one mode is useful diagnostic evidence; it does not by itself establish that Edge or Playwright is universally broken.

Rank #4
Sale
Microsoft Surface Laptop 4 13.5" Touch AMD RYZEN 5 16GB 256GB SSD Win 11 PRO Platinum (Renewed)
  • Microsoft Surface Laptop 4 features the latest AMD Ryzen 5 4680U CPU, 13.5-inch PixelSense Touchscreen Display (2256 x 1504) resolution | Certified Refurbished, Amazon Renewed
  • 256GB Solid State Drive, 16GB RAM, Platinum Silver Color, Clean, elegant design thin and light, starting at just 2.76 pounds, Surface Laptop 2 fits easily in your bag, Graphics: AMD RADEON 448SP
  • This Certified Refurbished product is tested and certified to look and work like new. The refurbishing process includes functionality testing, basic cleaning, inspection, and repackaging. The product ships with all relevant accessories, a minimum 90-day warranty, and may arrive in a generic box.
  • Bluetooth 4.0, Wi-Fi: 802.11ac Wireless LAN, Surface Pen NOT Included, USB 3.0, Mini DisplayPort, SD Card Slot., Windows 11 Professional

Local versus CI

If local execution succeeds but CI fails, inspect CI’s browser installation and cache in relation to the Playwright version used by that run. Playwright’s CI guidance covers browser installation and caching. Change cache or installation setup as a controlled diagnostic step; not every closure means a system dependency is missing.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Use a controlled comparison to isolate the cause

Change one factor at a time and keep the initial launch diagnostics. This comparison helps distinguish a browser-channel issue from profile reuse, execution mode, or a CI environment difference.

Comparison What to keep in mind
Bundled Playwright Chromium vs. branded Edge Playwright works best with its bundled Chromium; compatibility with another version is not guaranteed.
Edge Stable vs. Edge Beta Use another channel only if the project permits it; record the selected channel and version.
Headed vs. headless Edge’s newer headless behavior differs from Playwright’s default Chromium headless shell.
Local vs. CI Compare browser installation, cache, and launch output in the environment where the failure occurs.
Unique automation profile vs. reused profile Do not share a user-data directory between simultaneous browser launches.

Troubleshoot by symptom

  • Failure occurs immediately on launch: confirm Edge is installed, use channel: 'msedge', and inspect pw:browser output for the first launch error.
  • Failure begins when a second run starts: check whether both launches use the same persistent user-data directory; assign a unique directory to each concurrent run.
  • Failure follows a test or navigation step: look for earlier cleanup, unawaited work, or a browser crash in the logs; establish whether the page operation failed before the close message appeared.
  • Failure occurs only with custom flags or an executable: retry with Playwright defaults, then add back one custom setting at a time.
  • Failure occurs only on a managed machine: ask the administrator about Edge policies affecting automation.
  • Failure occurs only in one execution mode: compare headed and headless runs and note which one reproduces it.
  • Failure occurs only in CI: verify the browser installation and cache for the Playwright version in that job, then compare its launch output with a local run.

Or skip the browser setup

If you need a website image or PDF rather than a Playwright-controlled test, ScreenshotNeo is a screenshot API and MCP server. One GET request can return a PNG, JPEG, WebP, or PDF; its parameters also support the names used by other screenshot APIs, which can make switching easier. See the ScreenshotNeo documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

Before capture, ScreenshotNeo accepts the cookie or consent banner like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers identify the page verdict and whether the request was billed. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000.

Sign up for ScreenshotNeo’s free plan.

Frequently Asked Questions

Does Playwright install Microsoft Edge automatically?

No. Playwright does not install branded Edge by default; Edge must be installed separately.

Can I use Edge Beta with Playwright?

The Playwright browser guide lists Edge Beta support. Use it only if your project permits that channel, and record its version when diagnosing a failure.

Quick Recap

SaleBestseller No. 1
Bestseller No. 2
Microsoft Surface Laptop 4 15” Touch-Screen – Intel Core i7 - 32GB - 1TB Solid State Drive - Matte Black
Microsoft Surface Laptop 4 15” Touch-Screen – Intel Core i7 - 32GB - 1TB Solid State Drive - Matte Black
You’re going to need Word, Excel, and PowerPoint. Don’t forget to add Microsoft 365
$1,329.99
Bestseller No. 3

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
  2. Cupertino desk5 min
    Apple Unveils AirPods Max 2: The Upgrade That Should Have Happened Years AgoAirPods Max 2 adds H2-powered audio features and Apple claims up to 1.5× more effective ANC, but its design, Smart Case, and 20-hour battery rating are unchanged. Wired lossless audio…
  3. Cupertino desk4 min
    Apple’s OLED Touch MacBooks Are Coming—but the Dynamic Island Is the Real GambleApple has not announced an OLED touchscreen MacBook, but reports point to high-end models arriving in late 2026 or early 2027. The reported Mac Dynamic Island could be useful, but…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.