Skip to content

[Bug]: Issue with Playwright 1.50.1 on macOS 15.3 (Sequoia) - Page closes unexpectedly in non-headless mode #34693

Closed

Description

@rammesika

Version

1.50.1

Steps to reproduce

After upgrading to macOS 15.3 (Sequoia), I began encountering an issue where Playwright fails when launching Chromium in non-headless mode. Specifically, I am seeing the following error:

swift
Copy
Edit
Failed to create browser context or page: Error {
message='Page closed
name='Error
stack='Error: Page closed
at FrameSession.dispose (/private/var/folders/sw/mh9s52b17qz49p3629grjqnm0000gp/T/playwright-java-10961038274755770653/package/lib/server/chromium/crPage.js:492:52)
at CRPage.didClose (/private/var/folders/sw/mh9s52b17qz49p3629grjqnm0000gp/T/playwright-java-10961038274755770653/package/lib/server/chromium/crPage.js:152:60)
at CRBrowser._didDisconnect (/private/var/folders/sw/mh9s52b17qz49p3629grjqnm0000gp/T/playwright-java-10961038274755770653/package/lib/server/chromium/crBrowser.js:216:57)
at CRConnection. (/private/var/folders/sw/mh9s52b17qz49p3629grjqnm0000gp/T/playwright-java-10961038274755770653/package/lib/server/chromium/crConnection.js:84:39)
}
Steps to Reproduce:

Upgrade to macOS 15.3 (Sequoia).
Launch Playwright in non-headless mode using Chromium.
Encounter the "Page closed" error as soon as the browser context is created.
Expected Behavior: Playwright should launch Chromium in non-headless mode without issues.

Additional Information:

I'm using Playwright 1.50.1 (latest stable version).
The issue only started occurring after the macOS upgrade to 15.3 (Sequoia).
Running in headless mode works fine, and Chromium opens without any problems.
Permissions (Accessibility, Screen Recording, etc.) have been granted as required.
Environment:

macOS Version: 15.3 (Sequoia)
Playwright Version: 1.50.1
Browser: Chromium (non-headless mode)
Steps Taken to Resolve:

Tried reinstalling Playwright and Chromium (npx playwright install --force).
Tried running in headless mode (works fine).
Checked system permissions (Accessibility, Screen Recording, Full Disk Access).
Logs:

Error logs are included above.
Debugging logs from Playwright are available if needed.

Expected behavior

Playwright should launch Chromium in non-headless mode without issues, allowing interactions with the browser as expected.

Actual behavior

Playwright fails to launch Chromium in non-headless mode, with the error Page closed appearing immediately after the browser context is created.

Additional context

No response

Environment

macOS Version: 15.3 (Sequoia)
Playwright Version: 1.50.1
Browser: Chromium (non-headless mode)

Activity

  1. mxschmitt commented on Feb 10, 2025

    @mxschmitt
    Contributor

    Could you try running it with DEBUG=pw:browser env var set, this should give us more debug logs. Could you please provide a minimal reproducible, does it happen with e.g. this?

  2. MaxGood-AI commented on Feb 12, 2025

    @MaxGood-AI

    I have this issue as well. Here is a cleaned-up example of the debug logs:

    DEBUG=pw:browser npx playwright test --headed tests/multiple-avatar-feature/avatar-label.spec.ts
    
    > npx
    > playwright test --headed tests/multiple-avatar-feature/avatar-label.spec.ts
    
    
    Running 12 tests using 6 workers
    [setup] › auth.setup.ts:72:6 › Authenticate as avatar admin user
      pw:browser <launching> /Users/mishkinberteig/Library/Caches/ms-playwright/chromium-1148/chrome-mac/Chromium.app/Contents/MacOS/Chromium --disable-field-trial-config --disable-background-networking --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,ThirdPartyStoragePartitioning,LensOverlay,PlzDedicatedWorker --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 --unsafely-disable-devtools-self-xss-warnings --enable-use-zoom-for-dsf=false --no-sandbox --user-data-dir=/var/folders/2y/zfl7htwn6_3_phj4kzl372_h0000gn/T/playwright_chromiumdev_profile-amK6mG --remote-debugging-pipe --no-startup-window +0ms
    [setup] › auth.setup.ts:72:6 › Authenticate as avatar admin user
      pw:browser <launched> pid=4834 +1ms
    [setup] › auth.setup.ts:72:6 › Authenticate as avatar admin user
      pw:browser [pid=4834][err] 2025-02-12 13:08:19.711 Chromium[4834:2509326] +[IMKClient subclass]: chose IMKClient_Modern +1s
    [setup] › auth.setup.ts:72:6 › Authenticate as avatar admin user
      pw:browser [pid=4834] <gracefully close start> +412ms
    [setup] › auth.setup.ts:72:6 › Authenticate as avatar admin user
      pw:browser [pid=4834] <process did exit: exitCode=0, signal=null> +577ms
      pw:browser [pid=4834] starting temporary directories cleanup +0ms
    [setup] › auth.setup.ts:72:6 › Authenticate as avatar admin user
      pw:browser [pid=4834] finished temporary directories cleanup +36ms
      pw:browser [pid=4834] <gracefully close end> +0ms
    
    

    I have tried giving the playwright Chromium.app permission to run in System Settings > Privacy & Security > Developer Tools but that did not make any difference.

    This is fairly urgent for me since I do the final check on our automated tests before approving the push to production.

    Thanks!

  3. mxschmitt commented on Feb 12, 2025

    @mxschmitt
    Contributor

    Mishkin Berteig (@MaxGood-AI) are you on v1.50 as well? Could you try our Canary version?

  4. rammesika commented on Feb 12, 2025

    @rammesika
    Author

    this is what i get
    ~ ❯❯❯ npx playwright --version

    Version 1.49.0
    ~ ❯❯❯ /Users/ram.mesika/Library/Caches/ms-playwright/chromium-1148/chrome-mac/Chromium.app/Contents/MacOS/Chromium --version

    Chromium 131.0.6778.33
    ~ ❯❯❯ npx playwright open chromium

    Error: net::ERR_CONNECTION_REFUSED at http://chromium/
    Call log:

  5. rammesika commented on Feb 12, 2025

    @rammesika
    Author

    i will try chromium 131 and i will update

  6. MaxGood-AI commented on Feb 12, 2025

    @MaxGood-AI

    Max Schmitt (@mxschmitt) Got around to installing the Canary version:

    % npx playwright --version                                                                        
    
    > npx
    > playwright --version
    
    Version 1.51.0-alpha-2025-02-12
    

    Still getting the same error:

    [setup] › tests/auth.setup.ts:72:6 › Authenticate as avatar admin user
      pw:browser [pid=19316][err] 2025-02-12 16:59:55.369 Chromium[19316:2843827] +[IMKClient subclass]: chose IMKClient_Modern +4s
    

    Thanks!

  7. rammesika commented on Feb 12, 2025

    @rammesika
    Author
    1. why to install canary ver? (although it might be a good workaround, yet its not solving the root cause)
    2. i did find "something" that works, but its really bad

    instead of this
    /*
    Browser browserOld = browserType.launch(new BrowserType.LaunchOptions()
    .setHeadless(false)
    .setArgs(Arrays.asList("--start-maximized")));
    */
    i needed to use:
    Browser browser = playwright.chromium().launch(new BrowserType.LaunchOptions()
    .setHeadless(false)
    .setExecutablePath(Paths.get("/Users/{my user}/Library/Caches/ms-playwright/chromium-1148/chrome-mac/Chromium.app/Contents/MacOS/Chromium"))
    .setArgs(Arrays.asList("--start-maximized"))
    );

  8. MaxGood-AI commented on Feb 12, 2025

    @MaxGood-AI

    rammesika That's a good workaround, but I don't want to use it if I can avoid it since my developers are (mostly) on windows. I could always set up an environment variable for this, but it's frustrating to do stuff like that :-) As you say: "...its really bad"

  9. rammesika commented on Feb 12, 2025

    @rammesika
    Author

    yes

    i installed ver 131 of Chromiun manually.

    i run my Java test and saw.. without a reason, that the playwright is downloading ver 119... which is old ver. although there is a valid one 131...
    seems like the root cause

    Logger initialized: 1082811210 | Test: bestPractices | HTMLAccordion Initialized: true
    Downloading Chromium 119.0.6045.9 (playwright build v1084) from https://playwright.azureedge.net/builds/chromium/1084/chromium-mac-arm64.zip
    | | 0% of 131.1 Mb
    |■■■■■■■■ | 10% of 131.1 Mb
    |■■■■■■■■■■■■■■■■ | 20% of 131.1 Mb
    |■■■■■■■■■■■■■■■■■■■■■■■■ | 30% of 131.1 Mb
    |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ | 40% of 131.1 Mb
    |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ | 50% of 131.1 Mb
    |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ | 60% of 131.1 Mb
    |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ | 70% of 131.1 Mb
    |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ | 80% of 131.1 Mb
    |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ | 90% of 131.1 Mb
    |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■| 100% of 131.1 Mb
    Chromium 119.0.6045.9 (playwright build v1084) downloaded to /Users/ram/Library/Caches/ms-playwright/chromium-1084
    Downloading FFMPEG playwright build v1009 from https://playwright.azureedge.net/builds/ffmpeg/1009/ffmpeg-mac-arm64.zip
    | | 1% of 1 Mb
    |■■■■■■■■ | 11% of 1 Mb
    ...

  10. rammesika commented on Feb 12, 2025

    @rammesika
    Author

    this line

    Playwright playwright = Playwright.create();

    is triggering the download of ver 119..
    i added before
    System.setProperty("PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD", "1");

    doesnt help

  11. rammesika commented on Feb 13, 2025

    @rammesika
    Author

    i used this hack (but will appreciate if you can have a look at why its (119) installed)

            Path basePath = Paths.get(System.getProperty("user.home"), "Library", "Caches", "ms-playwright");
            String chromiumPath = Arrays.stream(basePath.toFile().listFiles((dir, name) -> name.startsWith("chromium-")))
                    .max(Comparator.comparing(File::getName))
                    .map(file -> file.getAbsolutePath() + "/chrome-mac/Chromium.app/Contents/MacOS/Chromium")
                    .orElse(null);
            System.out.println("Latest Playwright Chromium Path: " + (chromiumPath != null ? chromiumPath : "Not found")); // i.e. "/Users/me/Library/Caches/ms-playwright/chromium-1148/chrome-mac/Chromium.app/Contents/MacOS/Chromium"
    
            Browser browser = playwright.chromium().launch(new BrowserType.LaunchOptions()
                    .setHeadless(false)
                     .setExecutablePath(Paths.get(chromiumPath)) //will use this specific version of chromium and not the default version
                    .setArgs(Arrays.asList("--start-maximized"))
            );
    
  12. mxschmitt commented on Feb 13, 2025

    @mxschmitt
    Contributor

    rammesika re #34693 (comment) Looks like you are using an old Playwright version in your Java project. Check your pom.xml and look for v1.39 which is the same Chromium version (outdated) like which you are using. Upgrading Playwright should help you and then you don't need to use the new Chromium version from #34693 (comment) aka. your hack.


    Mishkin Berteig (@MaxGood-AI) #34693 (comment) looks like a different issue. I recommend filing a new issue and following the issue template since mixing these two issues makes it confusing for the future.

  13. rammesika commented on Feb 13, 2025

    @rammesika
    Author

    i see why i used 1.39 and not 1.50.1
    since i got

    ./gradlew clean build

    Calculating task graph as configuration cache cannot be reused because file 'build.gradle' has changed.

    FAILURE: Build failed with an exception.

    • What went wrong:
      Configuration cache state could not be cached: field classpath of task :compileJava of type org.gradle.api.tasks.compile.JavaCompile: error writing value of type 'org.gradle.api.internal.artifacts.configurations.DefaultUnlockedConfiguration'

    Could not resolve all files for configuration ':compileClasspath'.
    Could not find com.microsoft.playwright:playwright:1.50.1.
    Searched in the following locations:
    - https://repo.maven.apache.org/maven2/com/microsoft/playwright/playwright/1.50.1/playwright-1.50.1.pom
    Required by:
    root project :

    • Try:

    If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
    Run with --stacktrace option to get the stack trace.
    Run with --info or --debug option to get more log output.
    Run with --scan to get full insights.
    Get more help at https://help.gradle.org.

    BUILD FAILED in 716ms

    Playwright 1.50.1 is not available on Maven Central. Playwright for Java is currently only published up to version 1.39.0.?

  14. mxschmitt commented on Feb 13, 2025

    @mxschmitt
    Contributor
  15. rammesika commented on Feb 13, 2025

    @rammesika
    Author

    tnx
    1.50.0 is ok. needed to clean the cache and hope now 1.50.0 + Chromium Version: 133.0.6943.16
    will do the job

  16. mxschmitt commented on Feb 14, 2025

    @mxschmitt
    Contributor

    Closing as per above since it seems to be solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions