playwright: [Bug]: Cannot open ui or run tests with chromium - Error: browserType.launch: Target page, context or browser has been closed

Version

1.41.2

Steps to reproduce

similar to issue https://github.com/microsoft/playwright/issues/28500

System info Playwright Version: 1.41.2 Operating System: Mac Node.js version: v20.3.0 Browser: Chromium Reproduces: always

Source code Just installed Playwright and I’m using the test files, haven’t made any changes (demo-todo-app.spec.ts and example.spec.ts)

Steps When running npx playwright test --ui, I’m getting the following: ProtocolError: Protocol error (Browser.getVersion): Internal server error, session closed.

When runningnpx playwright test, I’m getting errors on all Chromium test runs. Firefox and Webkit work fine.

Expected behavior

Can use UI mode, tests pass in chrome

Actual behavior

`Error: browserType.launch: Target page, context or browser has been closed Browser logs:

<launching> /Users/myUser/Library/Caches/ms-playwright/chromium-1097/chrome-mac/Chromium.app/Contents/MacOS/Chromium --disable-field-trial-config --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,DialMediaRouteProvider,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater,AvoidUnnecessaryBeforeUnloadCheckSync,Translate,HttpsUpgrades,PaintHolding --allow-pre-commit-input --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --no-service-autorun --export-tagged-pdf --disable-search-engine-choice-screen --enable-use-zoom-for-dsf=false --use-angle --headless --hide-scrollbars --mute-audio --blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4 --no-sandbox --user-data-dir=/var/folders/0_/kqkw512574d2xn91pntrmkmr0000gn/T/playwright_chromiumdev_profile-IhHsV9 --remote-debugging-pipe --no-startup-window <launched> pid=28962 Call log:

  • <launching> /Users/myUser/Library/Caches/ms-playwright/chromium-1097/chrome-mac/Chromium.app/Contents/MacOS/Chromium --disable-field-trial-config --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,DialMediaRouteProvider,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater,AvoidUnnecessaryBeforeUnloadCheckSync,Translate,HttpsUpgrades,PaintHolding --allow-pre-commit-input --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --no-service-autorun --export-tagged-pdf --disable-search-engine-choice-screen --enable-use-zoom-for-dsf=false --use-angle --headless --hide-scrollbars --mute-audio --blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4 --no-sandbox --user-data-dir=/var/folders/0_/kqkw512574d2xn91pntrmkmr0000gn/T/playwright_chromiumdev_profile-IhHsV9 --remote-debugging-pipe --no-startup-window
  • <launched> pid=28962`

Additional context

I’ve tried npx playwright install --with-deps chromium, npx playwright install and the most recent canary release to no avail. Cypress runs with Chrome work fine, so doesn’t seem to be a firewall issue. I’ve tried using version 1.40.1, which worked fine on January 3 when I first installed Playwright, but does not seem to be working any more either.

Environment

System:
    OS: macOS 14.3
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 2.27 GB / 16.00 GB
  Binaries:
    Node: 20.3.0 - /usr/local/bin/node
    npm: 9.6.7 - /usr/local/bin/npm
  Languages:
    Bash: 3.2.57 - /bin/bash
  npmPackages:
    @playwright/test: ^1.41.2 => 1.41.2 
    playwright: ^1.41.2 => 1.41.2

About this issue

  • Original URL
  • State: closed
  • Created 5 months ago
  • Comments: 18 (7 by maintainers)

Most upvoted comments

From what I can tell, it may be related to the APIRequestContext being included in a wrapper class that is instantiated in the beforeAll() and then referenced in a test. Is that a valid use case? It fails any time the APIRequestContext’s post method is referenced within a test.

Reverting back to playwright version 1.39.0 which uses playwright chromium 1084 fixes the issue for me. I don’t know why but would be nice to get this fixed. Not sure why this issue is closed everyone at my company is experiencing this.

Re-opened issue