Skip to content
This repository has been archived by the owner on Apr 1, 2019. It is now read-only.

Allow setting an environment variable to skip installation, for systems on which a compatible chromedriver is already installed #77

Closed
mkllnk opened this issue Feb 7, 2019 · 11 comments

Comments

@mkllnk
Copy link

mkllnk commented Feb 7, 2019

We just had some failing builds on Semaphore CI because chromedriver-helper is installing the latest chromedriver version while Semaphore is not providing the latest Chrome. The workaround is to either install the latest Chrome or lock chromedriver to a compatible version (howto). But that will lead to an outdated chromedriver version one day. Some people also prefer to use their system's chromedriver instead of installing a new one through chromedriver-helper.

How difficult would it be to not install a new chromedriver if the system provides one already? It's how I expected this gem to work actually.

@flavorjones
Copy link
Owner

@mkllnk Thanks for asking this question.

I'm a little confused, can you help me understand why you're using the gem if you'd prefer it to be a no-op? Are you using a shared Gemfile across a variety of system configurations, or is there some other reason?

@mkllnk
Copy link
Author

mkllnk commented Feb 7, 2019

Yes, a variety of systems.

We have a diverse team with volunteer contributions from all over the world. Chromedriver-helper is extremely convenient for most contributors because they don't have to install chromedriver themselves. But in some environments it's not that useful. The last example was on Semaphore CI. It provides chrome and chromedriver and they work. Using chromedriver-helper can lead to versions that don't work together. So it's only one project, but the Gemfile is used in many different environments (various dev setups, CI, staging, production).

@flavorjones
Copy link
Owner

@mkllnk Thanks for the additional context, I understand more completely now.

I'm open to working with you or someone else on a PR along these lines, but would be more inclined to implement something simpler like looking for an environment variable that signals a desire to not install chromedriver, like CHROMEDRIVER_HELPER_NO_OP, which could be set in your CI system. Would this be sufficient for your needs?

I'm asking because I'd like to find the simplest solution to your problem, and I fear that a simple search for a chromedriver executable in $PATH (or similar) would break some people's use cases. My experience has been that you and I cannot imagine all the wacky stuff that people do to configure their development environments, and so a declarative solution (like setting an env var) is superior to attempting to discern intent from an examination of the filesystem.

@mkllnk
Copy link
Author

mkllnk commented Feb 8, 2019

Yes, that sounds very sensible and would be sufficient for my needs.

My team was also discussing an environment variable to define the chromedriver version. We can implement that ourselves with Chromedriver.set_version.

Another idea was to support Chromedriver.set_version = "system" to deactivate the installation. I'm not sure what is easier.

Looking at #78, the possibility to deactivate chromedriver-helper or specify a version for chromedriver would enable a third-party script to choose the right version. I could load a script in my bash-rc to check for chromedriver and the installed chrome version. It can then set the right environment variables to either keep the system chromedriver, install a specific version or the latest.

I agree that version management should not be in the chromedriver-helper. It can be in a script or another gem. And the proposed no-op switch would help with that. I appreciate your design thinking. 👍

@flavorjones
Copy link
Owner

OK - going to change the title on this to reflect the solution on which we're converging.

@flavorjones flavorjones changed the title Use system's chromedriver if available Allow setting an environment variable to skip installation, for systems on which a compatible chromedriver is already installed Feb 11, 2019
@mkllnk
Copy link
Author

mkllnk commented Feb 12, 2019

👍 Great! Do you think you will have time to do this? How much work would it be?

@flavorjones
Copy link
Owner

Yeah, I'm hoping to get to this in the next few days.

@cbandy
Copy link

cbandy commented Feb 22, 2019

I've started using the following snippet to detect and use whatever chromedriver executable is already installed. When it is not installed, chromedriver-helper remains the default/automatic selection.

`which chromedriver`.chomp.tap do |driver|
  Selenium::WebDriver::Chrome.driver_path = driver if $?.success?
end

@mkllnk
Copy link
Author

mkllnk commented Mar 13, 2019

@cbandy Can you explain your solution a bit more?

I'm not clear where you add your snippet. Before or after you register chrome as webdriver?

And I think in my case which chromedriver would always point to "~/.rbenv/shims/chromedriver". That doesn't reveal if the system has a chromedriver binary installed or not.

@cbandy
Copy link

cbandy commented Mar 15, 2019

Before or after you register chrome as webdriver?

I did it before, but I suspect it might not matter.

chromedriver executable in rbenv is from this gem prior to version 2.0. Since then, the executable created by this gem is chromedriver-helper.

@flavorjones
Copy link
Owner

I'm going to close this issue, as the gem is being deprecated in favor of webdrivers, see #83.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants