-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
[rust][selenium-manager]: do not ignore browser path when version is specified #17659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Delta456
wants to merge
7
commits into
SeleniumHQ:trunk
Choose a base branch
from
Delta456:selenium_manager
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+168
β1
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f93ded1
[rust][selenium-manager]: do not ignore browser path when version is β¦
Delta456 26efb88
fix ci
Delta456 02638fb
fix issue
Delta456 c179266
Merge branch 'trunk' into selenium_manager
Delta456 4f3546e
oops
Delta456 ac6d270
Merge branch 'trunk' into selenium_manager
Delta456 c1dd3d1
Merge branch 'trunk' into selenium_manager
Delta456 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -82,6 +82,7 @@ pub const DEV: &str = "dev"; | |
| pub const CANARY: &str = "canary"; | ||
| pub const NIGHTLY: &str = "nightly"; | ||
| pub const ESR: &str = "esr"; | ||
| pub const BROWSER_VERSION_IGNORE: &str = "ignore"; | ||
| pub const REG_VERSION_ARG: &str = "version"; | ||
| pub const REG_PV_ARG: &str = "pv"; | ||
| pub const DASH_VERSION: &str = "-v"; | ||
|
|
@@ -514,6 +515,7 @@ pub trait SeleniumManager { | |
| } | ||
| if !download_browser && !self.is_electron() { | ||
| let major_browser_version = self.get_major_browser_version(); | ||
| let original_browser_path = self.get_browser_path().to_string(); | ||
| match self.discover_browser_version()? { | ||
| Some(discovered_version) => { | ||
| if !self.is_safari() { | ||
|
|
@@ -523,9 +525,31 @@ pub trait SeleniumManager { | |
| discovered_version | ||
| )); | ||
| } | ||
| if self.is_browser_version_specific() | ||
| if self.is_browser_version_ignore() { | ||
| if !original_browser_path.is_empty() { | ||
| self.get_logger().warn(format!( | ||
| "Browser version check bypassed for {} at {}; using detected version {}", | ||
| self.get_browser_name(), | ||
| original_browser_path, | ||
| discovered_version | ||
| )); | ||
| } | ||
| self.set_browser_version(discovered_version); | ||
| } else if self.is_browser_version_specific() | ||
| && !self.get_browser_version().eq(&discovered_version) | ||
| { | ||
|
Comment on lines
+538
to
540
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1. --browser-path major mismatch allowed The new mismatch error path in discover_local_browser() only triggers when is_browser_version_specific() is true (i.e., the requested --browser-version contains a .), so a major-only version like 114/105 can still mismatch the detected version at an explicit --browser-path without failing fast. In that case, later major-version handling can set download_browser=true and effectively ignore the user-provided path, violating the requirement to clearly fail when --browser-path and --browser-version conflict. Agent Prompt
|
||
| if !original_browser_path.is_empty() { | ||
| return Err(anyhow!(format!( | ||
| "The browser at {} has version {} but {} {} was requested; \ | ||
| remove --browser-path to allow a browser download, or set \ | ||
| --browser-version {} to use the detected browser version", | ||
| original_browser_path, | ||
| discovered_version, | ||
| self.get_browser_name(), | ||
| self.get_browser_version(), | ||
| BROWSER_VERSION_IGNORE | ||
| ))); | ||
| } | ||
| download_browser = true; | ||
| } else { | ||
| let discovered_major_browser_version = self | ||
|
|
@@ -591,6 +615,25 @@ pub trait SeleniumManager { | |
| self.get_browser_name(), | ||
| self.get_browser_version_label() | ||
| )); | ||
| if self.is_browser_version_ignore() { | ||
| let detail = if !original_browser_path.is_empty() { | ||
| format!( | ||
| "Could not detect {} version at {}; \ | ||
| --browser-version {} requires a detectable local browser", | ||
| self.get_browser_name(), | ||
| original_browser_path, | ||
| BROWSER_VERSION_IGNORE | ||
| ) | ||
| } else { | ||
| format!( | ||
| "No local {} found; --browser-version {} requires a local browser \ | ||
| (use --browser-path to specify its location)", | ||
| self.get_browser_name(), | ||
| BROWSER_VERSION_IGNORE | ||
| ) | ||
| }; | ||
| return Err(anyhow!(detail)); | ||
| } | ||
| download_browser = true; | ||
| } | ||
| } | ||
|
|
@@ -817,6 +860,11 @@ pub trait SeleniumManager { | |
| self.is_version_specific(self.get_browser_version()) | ||
| } | ||
|
|
||
| fn is_browser_version_ignore(&self) -> bool { | ||
| self.get_browser_version() | ||
| .eq_ignore_ascii_case(BROWSER_VERSION_IGNORE) | ||
| } | ||
|
|
||
| fn is_driver_version_specific(&self) -> bool { | ||
| self.is_version_specific(self.get_driver_version()) | ||
| } | ||
|
|
||
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.