Skip to content

[🚀 Feature]: Add option to use chromedriver managed by Selenium Manager if PATH version not compatible #11989

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

Closed
stanhu opened this issue May 3, 2023 · 4 comments
Labels
A-needs-triaging A Selenium member will evaluate this soon! I-enhancement Something could be better

Comments

@stanhu
Copy link

stanhu commented May 3, 2023

Feature and motivation

We have a number of engineers who have chromedriver managed by Homebrew. When Chrome updates, they need to keep up-to-date with the latest chromedriver. Currently selenium-webdriver will download the right version of chromedriver ONLY if the Homebrew version is NOT installed.

Uninstalling the Homebrew version doesn't seem like it should be necessary. We would much prefer if selenium-webdriver would download and use the right version of chromedriver if the version in PATH isn't compatible.

One possible fix would be to drop the Platform.find_binary call here:

path ||= Platform.find_binary(klass::EXECUTABLE)
path ||= begin
SeleniumManager.driver_path(options)

As far as I understand, selenium-manager already looks in the PATH:

if let (Some(version), Some(path)) = self.find_driver_in_path() {

Usage example

This would allow the Homebrew version of chromedriver to coexist with the version managed by selenium-webdriver.

@stanhu stanhu added I-enhancement Something could be better A-needs-triaging A Selenium member will evaluate this soon! labels May 3, 2023
@github-actions
Copy link

github-actions bot commented May 3, 2023

@stanhu, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@stanhu
Copy link
Author

stanhu commented May 3, 2023

A workaround is to set the PATH to give precedence to the binary detected by selenium-manager:

chrome_options = Selenium::WebDriver::Chrome::Options.chrome
chromedriver_path = File.dirname(Selenium::WebDriver::SeleniumManager.driver_path(chrome_options))

Inside the Capybara.register_server, set the PATH:

ENV['PATH'] = "#{chromedriver_path}:#{ENV['PATH']}"

@titusfortner
Copy link
Member

Yes, this matches where we are planning to go. We're tracking this already, elsewhere. Here is an explanation of where we are, and the steps for where we want to go:
#11356 (comment)

There are a few complications we need to handle that make this non-trivial:

  • We want Selenium Manager to be entirely "opt-in" right now, which means if you are doing anything to manage drivers yourself, SM won't try to do it for you
  • If we do decide to do automatic fixes for users, we'll need to provide a way for them to completely opt-out from using SM (no downloading ever)
  • Also, users can intentionally use an old version of the driver by passing in a specific argument to the driver, so we'll need to parse that and pass it in as a flag to SM somehow as to whether to fix or use the outdated driver

Copy link

github-actions bot commented Dec 9, 2023

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-needs-triaging A Selenium member will evaluate this soon! I-enhancement Something could be better
Projects
None yet
Development

No branches or pull requests

2 participants