Rayrun
← Back to Discord Forum

Playwright on Apple Silicon

birdtakesbearposted in #help-playwright
Open in Discord
birdtakesbear
birdtakesbear

Am I missing something where playwright doesn't work properly on apple silicon? Chromium won't launch on apple silicon so none of the interactive features in VScode or others seem to work.

I can get tests to work with Chrome and others, but the VScode extension and others never successfully open chromium.

This thread is trying to answer question "Why is Playwright not launching Chromium on an M3 Mac and how can it be configured to use Chrome instead for recording tests in VSCode?"

18 replies

I’ve been using playwright with M2 over a year with no problems, vs code extension, ui mode, headed or headless works fine

Do you get any specific error?

It should work on M1, make sure to use a recent Playwright version.

birdtakesbear
birdtakesbear

It'd definitely a chromium issue. I'm on an M3 mac (thus the issue, it was fine on my intel before I got this one).

birdtakesbear
birdtakesbear

I get this error each time

Error: Target page, context or browser has been closed
Browser logs:

<launching> /Users/jroy/pw-browsers/chromium-1091/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 --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 --password-store=basic --use-mock-keychain --no-service-autorun --export-tagged-pdf --disable-search-engine-choice-screen --enable-use-zoom-for-dsf=false --no-sandbox --app=data:text/html, --window-size=600,600 --window-position=1020,10 --test-type= --user-data-dir=/var/folders/6z/c02bry0x4fq3jdm3kc4gzzj40000gp/T/playwright_chromiumdev_profile-gSp3N3 --remote-debugging-pipe about:blank
<launched> pid=31681
birdtakesbear
birdtakesbear

I can use regular chome, but playwright really, really wants to use chromium if it's installed. I have to force it not to, and the VSCode extension doesn't seem to be configureable for non chromium

birdtakesbear
birdtakesbear

telling playwright to use chrome doesn't seem to work for vscode or codegen.

projects: process.env.CI
      ? [
          {
            name: 'chromium',
            use: { ...devices['Desktop Chrome'] },
          },
          {
            name: 'firefox',
            use: devices['Desktop Firefox'],
          },
          { name: 'Mobile Chrome', use: devices['Pixel 5'] },
          { name: 'Mobile Safari', use: devices['iPhone 12'] },
        ]
      : [
          //Chromium does not work on my machine - so switching to chrome locally
          {
            name: 'chrome',
            use: { ...devices['Desktop Chrome'], channel: 'chrome' },
          },
          {
            name: 'webkit',
            use: { ...devices['Desktop Safari'] },
          },
          {
            name: 'firefox',
            use: devices['Desktop Firefox'],
          },
          { name: 'Mobile Chrome', use: devices['Pixel 5'] },
          { name: 'Mobile Safari', use: devices['iPhone 12'] },
        ],

Could you execute the following to see what it kind of Chromium executable it is? file /Users/jroy/pw-browsers/chromium-1091/chrome-mac/Chromium.app/Contents/MacOS/Chromium

birdtakesbear
birdtakesbear

/Users/jroy/pw-browsers/chromium-1091/chrome-mac/Chromium.app/Contents/MacOS/Chromium: Mach-O 64-bit executable arm64

birdtakesbear
birdtakesbear

I opened the console and streamed the output when I tried to open it. I do have company managed security policies on this laptop but, I didn't see anything related in the output. I do see something about a syspolicy in there, I wonder if this is because the chromium app registers as an iOS build? Console output attached

@birdtakesbear: This looks good!

This looks good!

Something looks off yeah, I see that you have the browsers at a custom location, why? Maybe try to npx playwright uninstall and npx playwright install

birdtakesbear
birdtakesbear

I tried that and it didn't work, thus the custom location. Doesn't work either way. I think I've found a way around using default crhome, but it would be nice if the VSCode extension would use chrome instead of chromium for recording tests - it defaults to chromium no matter what is in the config file

if you run a first test with "Show Browser" then the browser stays open and the recorder will use that browser.

birdtakesbear
birdtakesbear

oh, that's super helpful, thanks

birdtakesbear
birdtakesbear

appreciate it, I'll record some tests that way

birdtakesbear
birdtakesbear

I appreciate your help, I was just thinking other people might be running into this problem and wanted to make sure it was something I could help with. My IT lead is happy to experiment with settings if people think it's a managed device thing - we are flexible and want to help

Oh important information , yeah that’s very likely then since we have never seen this error and logs before

Related Discord Threads

TwitterGitHubLinkedIn
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.