Home » Blog » Fix C# PlayWright Error on Mac OS [Executable doesn’t exist]

Fix C# PlayWright Error on Mac OS [Executable doesn’t exist]

Encountering a C# PlayWright Error on Mac OS?

Are you trying to run Playwright tests using .NET 8 (C#) on your Mac OS? You might have encountered an error related to executables while following the official documentation.

Microsoft.Playwright.PlaywrightException : Executable doesn't exist at 
/Users/<username>/Library/Caches/ms-playwright/chromium-1124/chrome-mac/Chromium.app/Contents/MacOS/Chromium
╔════════════════════════════════════════════════════════════╗
║ Looks like Playwright was just installed or updated. ║
║ Please run the following command to download new browsers: ║
║ ║
║ pwsh bin/Debug/netX/playwright.ps1 install ║
║ ║
║ <3 Playwright Team ║
╚════════════════════════════════════════════════════════════╝
at Microsoft.Playwright.Transport.Connection.InnerSendMessageToServerAsync[T](ChannelOwner object, String method, Dictionary`2 dictionary, Boolean keepNulls)
in /_/src/Playwright/Transport/Connection.cs:line 206

pwsh bin/Debug/net8.0/playwright.ps1 install

 

 

C# PlayWright Error on Mac OS
C# PlayWright Error on Mac OS

Error Description

Playwright works with the Chromium browser and a few others. To run tests, your system must have the required browsers installed in a specific directory on macOS. Playwright expects the browsers to be available in the /Users/<username>/Library/Caches/ms-playwright/ directory.

[Read, Print all attributes of an element in PlayWright]

If you encounter the suggestion to run the PowerShell script pwsh bin/Debug/net8.0/playwright.ps1 install in the Playwright stack trace, here are two ways to address the issue:

Install PowerShell on Your Mac (Not Recommended)

Official instructions for setting up PowerShell on macOS are available. However, this approach is not recommended as installing PowerShell on macOS can introduce additional complexities and potential issues.

Install Chromium and Other Browsers Using Playwright Binaries

Instead, you can install Playwright as a global binary on your macOS system. Once installed, use the Playwright command to install the required browsers. This method is simpler and avoids the need for PowerShell.

dotnet tool install --global Microsoft.Playwright.CLI 
export PATH="$PATH:/Users/<username>/.dotnet/tools

# Verify PlayWright Install
playwright

# Install browsers
playwright install

Run you tests!! 😎

Your subscription encourages me to write more insightful articles.

Subscribe to my newsletter and explore Quality Assurance beyond just manual and automation testing!

We don’t spam! Read our privacy policy for more info.

Thank you for reading this post, don't forget to subscribe!

Priyanshu S
Priyanshu S

QA Consultant | Quality Advocate | Currently working with Equal Experts

Articles: 30

Leave a Reply