Principle:Cypress io Cypress Browser Detection
| Knowledge Sources | |
|---|---|
| Domains | Browser_Automation, Cross_Platform |
| Last Updated | 2026-02-12 00:00 GMT |
Overview
A cross-platform browser discovery mechanism that locates installed browsers on macOS, Linux, and Windows using platform-specific detection strategies.
Description
Browser detection must handle the fundamental differences in how browsers are installed across operating systems. On macOS, browsers are located via application bundles and mdfind commands. On Linux, they are found via binary paths and dpkg/'snap' queries. On Windows, they are found via registry keys.
The detection system maintains a list of known browsers with their expected binary names, version regex patterns, and platform-specific detection helpers. It iterates through these known browsers, checks if each is present, extracts version information, and returns a list of FoundBrowser objects.
Usage
Use this principle during Cypress setup when populating the browser selection list, and when a user specifies a custom browser path via --browser.
Theoretical Basis
Detection Strategy per Platform:
macOS (darwin/):
- mdfind for .app bundles
- /Applications/ path lookup
- CFBundleShortVersionString from Info.plist
Linux (linux/):
- which/whereis for binary paths
- dpkg/snap for package info
- --version flag parsing
Windows (windows/):
- Registry key lookup (HKLM, HKCU)
- Known installation paths
- File version extraction
Known Browser Families:
- chromium: Chrome, Chromium, Edge, Brave, Opera
- firefox: Firefox
- webkit: WebKit