Playwright Browser Installation Issue
If Chromium is not installed on your system or the version is mismatched, you may see errors when running a test from the UI. A common error message is:
Before/After hook failed with message: browserType.launch: Executable doesn't exist at C:\Users\<user>\AppData\Local\ms-playwright\chromium-xxxx\chrome-win\chrome.exe
This means the expected version of Chromium was not found. The error can occur if the wrong version of Playwright is installed or if the browser binaries have not been downloaded.
How to Fix the Issue
Open your project in VS Code.
In the root project folder, open a terminal and run:
bashnpx playwright install
(Optional) Check which version of Playwright is installed:
bashnpx playwright --version
(Optional) Check which browser versions would be installed:
bashnpx playwright install --dry-run
If the issue still persists, clear the cache and reinstall everything:
bashrm -rf node_modules rm -rf ~/.cache/ms-playwright npm install npx playwright install
Make sure you're using the Playwright version expected by your project. For example, to install version 1.50.1:
bashnpm install playwright@1.50.1 npx playwright install