You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Selenium Manager now looks for Chrome and Edge in their standard install locations on Linux, not just the single path it checked before (/usr/bin/google-chrome, /usr/bin/microsoft-edge). This lets it detect browsers installed elsewhere — e.g. on Arch Linux — instead of missing them and downloading a driver for the wrong version. For Chrome, those locations are exactly ChromeDriver's own, so the two resolve the same binary.
🔧 Implementation Notes
Chrome — matches ChromeDriver's search. For the default channel, Selenium Manager probes ChromeDriver's fixed Linux directory list (/usr/local/*, /usr/*, /opt/google/chrome, /opt/chromium.org/chromium) crossed with chrome/google-chrome/chromium/chromium-browser, in ChromeDriver's order (see chrome_finder.cc). Because it reproduces ChromeDriver's own documented search, both resolve the identical binary (e.g. /opt/google/chrome/chrome) regardless of $PATH order — agreement by construction.
Edge — added coverage, not verified parity. msedgedriver's binary search isn't published (it's a closed-source ChromeDriver fork), so this does not attempt to match it. It only gives Selenium Manager Edge's known install locations as extra candidates — /opt/microsoft/msedge × msedge/microsoft-edge/microsoft-edge-stable — plus the microsoft-edge/microsoft-edge-stable names in the $PATH fallback (which previously searched only edge, never a real Linux binary, so Edge had no working fallback). This stops Selenium Manager missing Edge; it does not guarantee the exact binary msedgedriver would pick.
Both go through a detect_browser_in_known_locations hook on the manager trait (default no-op), scoped to the default channel at the call site (a fixed-directory search is channel-agnostic; beta/dev keep their channel-specific paths).
Copying ChromeDriver's directory list is low-risk and cheap: the list hasn't changed since 2018 (byte-identical across the 2018/2020/2026 revisions of chrome_finder.cc), and the added work is a handful of Path::exists() checks — negligible next to the --version subprocess Selenium Manager already spawns to detect the browser version.
🤖 AI assistance
AI assisted (complete below)
Tool(s): Claude Code (Opus 4.8)
What was generated: the browser-detection change in chrome.rs/edge.rs/lib.rs, the unit tests, and the backward-compatibility analysis
I reviewed all AI output and can explain the change
💡 Additional Considerations
Backward compatibility — applies only when no --browser-path is given, and only to the default channel. Selenium Manager now resolves the exact binary ChromeDriver does (the SM (this PR) and ChromeDriver columns match in every row). For standard installs that's the same browser and version as before, just reported via the canonical /opt/google/chrome/chrome path ChromeDriver uses instead of the /usr/bin symlink. Row 1 is the common case (path-only change, same version); row 2 is the reported bug; rows 3–4 are low-likelihood (two Chrome-family browsers installed side by side).
Installed browsers (Linux)
ChromeDriver
SM (current)
SM (this PR)
Standard Debian/Ubuntu • /usr/bin/google-chrome (symlink → /opt/google/chrome/chrome)
/opt/google/chrome/chrome
/usr/bin/google-chrome
/opt/google/chrome/chrome
Arch Linux default • /usr/bin/google-chrome-stable (symlink → /opt/google/chrome/chrome) • no /usr/bin/google-chrome
/opt/google/chrome/chrome
none — downloads latest CfT
/opt/google/chrome/chrome
Arch Linux + Chromium • /usr/bin/google-chrome-stable (symlink → /opt/google/chrome/chrome) (version X) • /usr/bin/chromium (version Y) • no /usr/bin/google-chrome
/opt/google/chrome/chrome (X)
/usr/bin/chromium (Y)
/opt/google/chrome/chrome (X)
Two Chromium packages • /usr/bin/chromium (version X) • /usr/bin/chromium-browser (version Y) • no Google Chrome
/usr/bin/chromium (X)
/usr/bin/chromium-browser (Y)
/usr/bin/chromium (X)
Edge sees only the same benign path shift — existing installs now report /opt/microsoft/msedge/msedge (same version) — and has no equivalent of the multi-browser rows above, since it has no Chromium-style sibling. Firefox needs no change: geckodriver already locates the browser through $PATH (plus the snap path), which Selenium Manager already matches.
Detect Chrome and Edge in standard Linux install locations
🐞 Bug fix🧪 Tests🕐 20-40 Minutes
AI Description
• Detect Chrome and Edge across standard Linux installation directories.
• Preserve channel-specific discovery while prioritizing default-channel known locations.
• Add binary-name and Linux-only detection tests.
The trait hook with a default no-op is the appropriate approach: it isolates browser-specific search order, preserves all other managers, and retains existing channel and PATH fallbacks. A shared directory-scanning helper was considered, but the small Chrome and Edge lists have different ordering and parity guarantees, so centralizing them would add abstraction without materially reducing risk.
Files changed (4) +113 / -2
Bug fix (3) +78 / -2
chrome.rsMirror ChromeDriver's Linux binary search locations+33/-1
Mirror ChromeDriver's Linux binary search locations
• Expands Chrome PATH executable names and probes ChromeDriver-compatible fixed Linux directories in deterministic order. The search remains disabled on non-Linux platforms.
edge.rsSearch known Linux locations for Edge binaries+27/-1
Search known Linux locations for Edge binaries
• Adds real Linux Edge executable names for PATH discovery and probes standard directories, including '/opt/microsoft/msedge'. Non-Linux platforms continue using existing detection behavior.
lib.rsAdd a default-channel known-location detection hook+18/-0
Add a default-channel known-location detection hook
• Introduces an optional manager trait hook for browser-specific known locations. Default-channel discovery invokes it before existing channel-path and PATH detection, then canonicalizes and records successful results.
1. WebView2 casing bypasses guard✓ Resolved🐞 Bug≡ Correctness⭐ New
Description
Manager selection accepts browser names case-insensitively but preserves their original casing,
while the new WebView2 guard uses a case-sensitive comparison. A supported input such as `--browser
WebView2` therefore receives Edge executable candidates and can resolve an installed Edge binary
instead of WebView2.
Manager selection lowercases the input only for validation and then passes the original string to
EdgeManager, which stores it unchanged. Because is_webview2() uses case-sensitive eq, the new
guards at lines 118 and 131 fail for accepted variants such as WebView2, enabling Edge PATH
aliases and known-location lookup.
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution
## Issue description
Mixed-case WebView2 names accepted by manager selection bypass the new WebView2-specific exclusions because `is_webview2()` compares case-sensitively. This allows Edge PATH aliases and Linux known-location detection to run for WebView2.
## Issue Context
`get_manager_by_browser()` validates a lowercase copy but passes the original browser name into `EdgeManager`. Normalize the stored name or make the WebView2 predicate case-insensitive, and add a mixed-case regression test covering both detection methods.
## Fix Focus Areas
- rust/src/lib.rs[793-795]
- rust/src/edge.rs[117-134]
- rust/tests/browser_tests.rs[273-279]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
The unit test uses a fixed, process-global temporary directory, allowing concurrent executions to
delete or mutate each other's fixtures and causing nondeterministic failures. Interrupted runs can
also leave incompatible filesystem state that breaks subsequent setup, making the test
environment-dependent rather than reliably isolated.
+ let base = std::env::temp_dir().join("sm-first-existing-path-test");
Evidence
Compliance rule 5 requires reliable unit tests, but the fixed directory at line 278 and the shared
filesystem setup, lookup, and manual cleanup through line 296 allow concurrent test processes to
race and previously interrupted runs to leave stale state. The repository already includes
tempfile and uses tempfile::tempdir() in other tests to provide isolated, uniquely named,
RAII-managed fixtures.
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution
## Issue description
The test uses the fixed path `sm-first-existing-path-test` beneath `std::env::temp_dir()`, allowing concurrent test processes or stale artifacts from interrupted runs to interfere with fixture setup, lookup, and cleanup.
## Issue Context
The project already depends on `tempfile` and uses `tempfile::tempdir()` in other tests. Replace the deterministic shared directory with an automatically unique temporary directory and rely on its RAII cleanup behavior to isolate each test execution.
## Fix Focus Areas
- rust/tests/browser_tests.rs[278-296]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
The added tests only verify that known-location detection returns None for a simulated non-Linux
OS; they never exercise successful Linux discovery, candidate ordering, or the integration into
detect_browser_path(). Regressions in the PR's primary behavior could therefore pass the test
suite.
Compliance rule 5 requires appropriate coverage of changed behavior. The production code introduces
positive filesystem searches across fixed directories, but the new tests cover only name vectors and
the early non-Linux return, leaving the successful search and call-site behavior untested.
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution
## Issue description
The tests do not exercise successful Chrome or Edge discovery in known Linux installation locations, which is the primary behavior introduced by this change.
## Issue Context
Add small deterministic tests, preferably by extracting a helper that accepts candidate directories so temporary directories can verify successful discovery and precedence without modifying system paths. Also verify that `detect_browser_path()` uses the discovered candidate for the default channel.
## Fix Focus Areas
- rust/src/chrome.rs[239-263]
- rust/src/edge.rs[108-131]
- rust/src/lib.rs[428-441]
- rust/tests/browser_tests.rs[241-271]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
get_browser_names_in_path() now replaces the requested Edge name with only two Linux package
names, even though public manager creation supports aliases such as edge, msedge,
microsoftedge, and webview2. As a result, supported aliases in nonstandard PATH locations or
on other platforms may no longer be discovered, causing Selenium Manager to report Edge as
unavailable despite the requested executable being present.
Compliance rule 1 requires preserving public API behavior: EDGE_NAMES exposes aliases including
edge, msedge, microsoftedge, and webview2, and get_manager_by_browser() passes the
selected alias to EdgeManager::new_with_name(), which retains it. Because the generic fallback
searches only the values returned by get_browser_names_in_path(), removing
self.get_browser_name() discards the configured alias during PATH lookup; the fixed Linux
candidates do not cover arbitrary PATH directories, all accepted aliases, or other platforms.
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution
## Issue description
Preserve `PATH` discovery for supported Edge aliases while retaining the new Linux executable candidates. `EdgeManager::get_browser_names_in_path()` currently replaces the requested browser name with two fixed names, omitting accepted aliases such as `edge`, `msedge`, `microsoftedge`, and `webview2`.
## Issue Context
`get_manager_by_browser()` accepts names from `EDGE_NAMES` and passes the requested name into `EdgeManager`, while the generic `PATH` fallback searches only the values returned by `get_browser_names_in_path()`. Keep the new real Linux binary candidates, restore lookup using the manager's requested browser name, preserve existing alias behavior, and update tests to cover alias-specific managers.
## Fix Focus Areas
- rust/src/edge.rs[40-45]
- rust/src/edge.rs[78-87]
- rust/src/edge.rs[104-106]
- rust/src/lib.rs[696-715]
- rust/tests/browser_tests.rs[257-264]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
The added tests only verify that known-location detection returns None for a simulated non-Linux
OS; they never exercise successful Linux discovery, candidate ordering, or the integration into
detect_browser_path(). Regressions in the PR's primary behavior could therefore pass the test
suite.
Compliance rule 5 requires appropriate coverage of changed behavior. The production code introduces
positive filesystem searches across fixed directories, but the new tests cover only name vectors and
the early non-Linux return, leaving the successful search and call-site behavior untested.
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution
## Issue description
The tests do not exercise successful Chrome or Edge discovery in known Linux installation locations, which is the primary behavior introduced by this change.
## Issue Context
Add small deterministic tests, preferably by extracting a helper that accepts candidate directories so temporary directories can verify successful discovery and precedence without modifying system paths. Also verify that `detect_browser_path()` uses the discovered candidate for the default channel.
## Fix Focus Areas
- rust/src/chrome.rs[239-263]
- rust/src/edge.rs[108-131]
- rust/src/lib.rs[428-441]
- rust/tests/browser_tests.rs[241-271]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
get_browser_names_in_path() now replaces the requested Edge name with only two Linux package
names, even though public manager creation supports aliases such as edge, msedge,
microsoftedge, and webview2. As a result, supported aliases in nonstandard PATH locations or
on other platforms may no longer be discovered, causing Selenium Manager to report Edge as
unavailable despite the requested executable being present.
Compliance rule 1 requires preserving public API behavior: EDGE_NAMES exposes aliases including
edge, msedge, microsoftedge, and webview2, and get_manager_by_browser() passes the
selected alias to EdgeManager::new_with_name(), which retains it. Because the generic fallback
searches only the values returned by get_browser_names_in_path(), removing
self.get_browser_name() discards the configured alias during PATH lookup; the fixed Linux
candidates do not cover arbitrary PATH directories, all accepted aliases, or other platforms.
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution
## Issue description
Preserve `PATH` discovery for supported Edge aliases while retaining the new Linux executable candidates. `EdgeManager::get_browser_names_in_path()` currently replaces the requested browser name with two fixed names, omitting accepted aliases such as `edge`, `msedge`, `microsoftedge`, and `webview2`.
## Issue Context
`get_manager_by_browser()` accepts names from `EDGE_NAMES` and passes the requested name into `EdgeManager`, while the generic `PATH` fallback searches only the values returned by `get_browser_names_in_path()`. Keep the new real Linux binary candidates, restore lookup using the manager's requested browser name, preserve existing alias behavior, and update tests to cover alias-specific managers.
## Fix Focus Areas
- rust/src/edge.rs[40-45]
- rust/src/edge.rs[78-87]
- rust/src/edge.rs[104-106]
- rust/src/lib.rs[696-715]
- rust/tests/browser_tests.rs[257-264]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
The unit test uses a fixed, process-global temporary directory, allowing concurrent executions to
delete or mutate each other's fixtures and causing nondeterministic failures. Interrupted runs can
also leave incompatible filesystem state that breaks subsequent setup, making the test
environment-dependent rather than reliably isolated.
+ let base = std::env::temp_dir().join("sm-first-existing-path-test");
Evidence
Compliance rule 5 requires reliable unit tests, but the fixed directory at line 278 and the shared
filesystem setup, lookup, and manual cleanup through line 296 allow concurrent test processes to
race and previously interrupted runs to leave stale state. The repository already includes
tempfile and uses tempfile::tempdir() in other tests to provide isolated, uniquely named,
RAII-managed fixtures.
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution
## Issue description
The test uses the fixed path `sm-first-existing-path-test` beneath `std::env::temp_dir()`, allowing concurrent test processes or stale artifacts from interrupted runs to interfere with fixture setup, lookup, and cleanup.
## Issue Context
The project already depends on `tempfile` and uses `tempfile::tempdir()` in other tests. Replace the deterministic shared directory with an automatically unique temporary directory and rely on its RAII cleanup behavior to isolate each test execution.
## Fix Focus Areas
- rust/tests/browser_tests.rs[278-296]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
B-managerSelenium ManagerC-rustRust code is mostly Selenium Manager
3 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔗 Related Issues
Fixes #17823
💥 What does this PR do?
Selenium Manager now looks for Chrome and Edge in their standard install locations on Linux, not just the single path it checked before (
/usr/bin/google-chrome,/usr/bin/microsoft-edge). This lets it detect browsers installed elsewhere — e.g. on Arch Linux — instead of missing them and downloading a driver for the wrong version. For Chrome, those locations are exactly ChromeDriver's own, so the two resolve the same binary.🔧 Implementation Notes
/usr/local/*,/usr/*,/opt/google/chrome,/opt/chromium.org/chromium) crossed withchrome/google-chrome/chromium/chromium-browser, in ChromeDriver's order (seechrome_finder.cc). Because it reproduces ChromeDriver's own documented search, both resolve the identical binary (e.g./opt/google/chrome/chrome) regardless of$PATHorder — agreement by construction./opt/microsoft/msedge×msedge/microsoft-edge/microsoft-edge-stable— plus themicrosoft-edge/microsoft-edge-stablenames in the$PATHfallback (which previously searched onlyedge, never a real Linux binary, so Edge had no working fallback). This stops Selenium Manager missing Edge; it does not guarantee the exact binary msedgedriver would pick.detect_browser_in_known_locationshook on the manager trait (default no-op), scoped to the default channel at the call site (a fixed-directory search is channel-agnostic; beta/dev keep their channel-specific paths).chrome_finder.cc), and the added work is a handful ofPath::exists()checks — negligible next to the--versionsubprocess Selenium Manager already spawns to detect the browser version.🤖 AI assistance
chrome.rs/edge.rs/lib.rs, the unit tests, and the backward-compatibility analysis💡 Additional Considerations
Backward compatibility — applies only when no
--browser-pathis given, and only to the default channel. Selenium Manager now resolves the exact binary ChromeDriver does (theSM (this PR)andChromeDrivercolumns match in every row). For standard installs that's the same browser and version as before, just reported via the canonical/opt/google/chrome/chromepath ChromeDriver uses instead of the/usr/binsymlink. Row 1 is the common case (path-only change, same version); row 2 is the reported bug; rows 3–4 are low-likelihood (two Chrome-family browsers installed side by side).•
/usr/bin/google-chrome(symlink →/opt/google/chrome/chrome)/opt/google/chrome/chrome/usr/bin/google-chrome/opt/google/chrome/chrome•
/usr/bin/google-chrome-stable(symlink →/opt/google/chrome/chrome)• no
/usr/bin/google-chrome/opt/google/chrome/chrome/opt/google/chrome/chrome•
/usr/bin/google-chrome-stable(symlink →/opt/google/chrome/chrome) (version X)•
/usr/bin/chromium(version Y)• no
/usr/bin/google-chrome/opt/google/chrome/chrome(X)/usr/bin/chromium(Y)/opt/google/chrome/chrome(X)•
/usr/bin/chromium(version X)•
/usr/bin/chromium-browser(version Y)• no Google Chrome
/usr/bin/chromium(X)/usr/bin/chromium-browser(Y)/usr/bin/chromium(X)Edge sees only the same benign path shift — existing installs now report
/opt/microsoft/msedge/msedge(same version) — and has no equivalent of the multi-browser rows above, since it has no Chromium-style sibling. Firefox needs no change: geckodriver already locates the browser through$PATH(plus the snap path), which Selenium Manager already matches.🔄 Types of changes