Browser Paths
browser-paths is a tiny cross‑platform helper crate that locates the executable file paths of Chrome and Edge (stable / beta / dev / canary) on the current machine.
It supports Linux, macOS, and Windows, and returns Option<PathBuf> so you can easily integrate it into tooling, CLIs, test runners, or browser automation.
Features
- Chrome & Edge support:
- Stable, Beta, Dev, Canary channels
- Cross‑platform:
- Linux: uses the
whichcrate and distro‑style binary names (e.g.google-chrome-stable) - macOS: resolves
/Applications/*.app/Contents/MacOS/* - Windows: searches
LOCALAPPDATA,PROGRAMFILES,ProgramFiles(x86)for the standard install locations
- Linux: uses the
- Simple API:
- Convenience functions for Chrome and Edge
- Helpers to get "latest" (prefer Canary/Dev) and "stable" (prefer Stable/Beta)
Installation
Add this crate to your Cargo.toml:
[]
= "1.0.1"
Usage
All public helpers live in the crate root and return Option<PathBuf>.
use ;
Channel‑specific helpers
If you only care about a specific release channel, you can use:
- Chrome:
get_chrome_path()– Stableget_chrome_beta_path()– Betaget_chrome_dev_path()– Devget_chrome_canary_path()– Canary
- Edge:
get_edge_path()– Stableget_edge_beta_path()– Betaget_edge_dev_path()– Devget_edge_canary_path()– Canary
All of these return Option<PathBuf>, which will be None if that channel is not installed on the current platform.
Platform notes
-
Linux
- Uses the
whichcrate to resolve browser binaries. - Expected names include:
- Chrome:
google-chrome-stable,google-chrome-beta,google-chrome-unstable,google-chrome-canary - Edge:
microsoft-edge-stable,microsoft-edge-beta,microsoft-edge-dev,microsoft-edge-canary
- Chrome:
- Uses the
-
macOS
- Looks for applications in
/Applicationsonly, using names like:- Chrome:
Google Chrome.app,Google Chrome Beta.app,Google Chrome Dev.app,Google Chrome Canary.app - Edge:
Microsoft Edge.app,Microsoft Edge Beta.app,Microsoft Edge Dev.app,Microsoft Edge Canary.app
- Chrome:
- Looks for applications in
-
Windows
- Searches these prefixes:
%LOCALAPPDATA%%PROGRAMFILES%%ProgramFiles(x86)%
- And then appends the standard install suffix:
- Chrome:
Google\<Channel>\Application\chrome.exe - Edge:
Microsoft\<Channel>\Application\msedge.exe
- Chrome:
- Searches these prefixes:
If a browser or channel is not installed in the expected path, the corresponding function will simply return None.
Testing
This crate includes basic tests that assert the discovered paths exist on the current machine. Because they depend on your local browser setup, you may want to run them only on machines where you expect all channels to be installed (e.g. CI images or a dev machine with all variants).
Run tests with:
Tracked manual test coverage:
-
macOS
- Microsoft Edge
- Google Chrome
- Microsoft Edge Dev
- Google Chrome Dev
- Microsoft Edge Beta
- Google Chrome Beta
- Microsoft Edge Canary
- Google Chrome Canary
-
Ubuntu / Linux
- Microsoft Edge
- Google Chrome
- Microsoft Edge Dev
- Google Chrome Dev
- Microsoft Edge Beta
- Google Chrome Beta
- Microsoft Edge Canary
- Google Chrome Canary
-
Windows
- Microsoft Edge
- Google Chrome
- Microsoft Edge Dev
- Google Chrome Dev
- Microsoft Edge Beta
- Google Chrome Beta
- Microsoft Edge Canary
- Google Chrome Canary
Credits
browser-paths has been inspired by several outstanding projects in the community:
- @edge-paths - Possible paths or binary names of Edge in the current platform
- @agent-infra/browser-finder - find browser in your system
License
This project is licensed under the MIT License.