Git Product home page Git Product logo

Comments (20)

flavorjones avatar flavorjones commented on June 27, 2024 2

OK, I've merged #58 and this will be fixed in a v2.0.0 release shortly.

from chromedriver-helper.

mattbrictson avatar mattbrictson commented on June 27, 2024 1

This issue seems pretty intractable without making a breaking change.

Note that chromedriver-helper is included by default in every new Rails project generated by rails new, so it is very hard to avoid installing this gem on your system at some point. This particularly affects people who are learning Rails, as they are more likely to be following tutorials and doing other experiments involving rails new. Once the gem gets installed, removing it entirely (and keeping it removed) is tedious.

The bundle config --path .bundle solution works, but it is pretty brute-force. That would mean every project using its own copies of gems, which slows down bundle install for developers that switch between many projects. I don't like the idea of having to change my global bundler config to work around one gem problem.

I think #58 is a great approach.

from chromedriver-helper.

flavorjones avatar flavorjones commented on June 27, 2024 1

Note that chromedriver-helper is included by default in every new Rails project generated by rails new

😱 🚒 I did not know that.

I've re-opened #58 and will take another look. I appreciate everyone's comments here!

from chromedriver-helper.

flavorjones avatar flavorjones commented on June 27, 2024

Have you tried adding the gem to your bundle? I believe this will address your issue, which I suspect is based in your $PATH containing an executable script chromedriver but your bundle exec environment does not.

from chromedriver-helper.

mfazekas avatar mfazekas commented on June 27, 2024

Have you tried adding the gem to your bundle? I believe this will address your issue, which I suspect is based in your $PATH containing an executable script chromedriver but your bundle exec environment does not.

Yes the 2 workarounds are:

  • add chromedriver-helper to your Gemfile
  • remove chromedriver-helper gem, from the machine:gem uninstall chromedriver-helper

The point is that if you're working on multiple projects, either all of them or non of them should have chromedriver-helper which is less than ideal.

from chromedriver-helper.

flavorjones avatar flavorjones commented on June 27, 2024

Sorry, to be clear I meant to only install into your bundler environments. gem install will put an executable into your global path. If you avoid the global install and only install into your projects, you shouldn't have a problem.

from chromedriver-helper.

mfazekas avatar mfazekas commented on June 27, 2024

Sorry, to be clear I meant to only install into your bundler environments. gem install will put an executable into your global path. If you avoid the global install and only install into your projects, you shouldn't have a problem.

Even if i install through bundler i still end up with a chromedriver executable in my PATH. I've never did gem install chromedriver-helper, only bundle install.

Bundler work by installing the gem globally and then only selecting the ones in the Gemfile when you do bundle exec.

$ which chromedriver
/usr/local/bin/chromedriver
$ mkdir -p /tmp/chtest ; cd /tmp/chtest
$ bundle init
$ echo 'gem "chromedriver-helper"' >> Gemfile
$ bundle install
Fetching gem metadata from https://rubygems.org/..............
Resolving dependencies...
Using io-like 0.3.0
Using archive-zip 0.11.0
Using bundler 1.16.1
Using mini_portile2 2.3.0
Using nokogiri 1.8.4
Fetching chromedriver-helper 1.2.0
Installing chromedriver-helper 1.2.0
Bundle complete! 1 Gemfile dependency, 6 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
$ which chromedriver
~/.rvm/gems/ruby-2.4.0/bin/chromedriver

from chromedriver-helper.

twalpole avatar twalpole commented on June 27, 2024

@flavorjones Not true, at least if using rbenv - could be different with rvm --- Adding chromedriver-helper to any project ends up with $HOME/.rbenv/shims/chromedriver being installed which ends up being in the PATH at all times (even when not in that project), and prevents access to any system version of chromedriver installed, often leading to failures. Basically once you use chromedriver-helper in one project you need to use it in all projects where chromedriver is needed.

from chromedriver-helper.

flavorjones avatar flavorjones commented on June 27, 2024

OK, I see now, thanks all for explaining more clearly. (I will note that the OP did indicate that installation was via gem install which did lead me down the wrong path.)

I'm open to solutions here. This isn't a problem I have, personally, and it's not clear to me what the "right" way to solve it is. Any ideas?

from chromedriver-helper.

twalpole avatar twalpole commented on June 27, 2024

Given that no one really runs chromedriver manually (so no shim is really needed) -- I wonder what would happen if chromedriver was not specified as an executable in the gemspec - would that prevent a shim being added for it, but still provide it in the path when in the bundle environment? never mind - wouldn't work - but overall the solution would be to prevent a shim from being installed for chromedriver

from chromedriver-helper.

mfazekas avatar mfazekas commented on June 27, 2024

Another thing to try would be using a different shim name (chromedriver-helper) for example. Then use Selenium::WebDriver::Chrome.driver_path= to make capybara use that.

from chromedriver-helper.

twalpole avatar twalpole commented on June 27, 2024

@mfazekas In that case you'd probably just be better off using the webdrivers gem rather than chromedriver-helper

from chromedriver-helper.

mfazekas avatar mfazekas commented on June 27, 2024

@mfazekas In that case you'd probably just be better off using the webdrivers gem rather than chromedriver-helper

@twalpole can you ellaborate? The point is changing chromedirver-helper so that it won't break projects not using it. I don't want to use any of those gems, i just don't want to have my projects broken just because i did bundle install on a project using them.

I've suggested chaging the shim name to chromedriver-helperfrom chromedriver in chromedriver-helper gem and also adding a minimal code to chromedriver-helper helper gem to tell selenium-webdriver to default to this executable. That way if the gem will not shadow the system isntalled chromedriver. AFAIK all uses of chromedriver ends up being through selenium-webdriver gem, definetely the case with capybara.

from chromedriver-helper.

timdiggins avatar timdiggins commented on June 27, 2024

To summarize: I think the problem here is when someone starts using / contributing to A_PROJECT already using chromedriver-helper, then they find that ANOTHER_PROJECT not using chromedriver-helper suddenly is broken.

I think: This won't happen if you're using rvm with separate gemsets for the two projects (and maybe other ruby management mechanisms) for A_PROJECT. It also won't happen if you aren't using bundler for either project (but that seems rare).

If I have understood correctly, the problem is that the chromedriver bin file is generated with bundler, and is then placed in the global path but shadows the original chromedriver binary wherever that path is availble (ie for that ruby) but the bundle may not be available .

So...

Is there a way to customize the failure of the bin when if fails to find the gem to revert to ? (I think that that wrapper bin is created by bundler/rubygems rather than the chromedriver, but I may be wrong here)

I'm guessing this might happen to someone new to ruby and would be totally mystifying.

from chromedriver-helper.

mfazekas avatar mfazekas commented on June 27, 2024

FWIW: https://makandracards.com/makandra/47846-chromedriver-helper-gem-in-gemfile-might-break-you-selenium-tests-of-other-projects

from chromedriver-helper.

mfazekas avatar mfazekas commented on June 27, 2024

Is there a way to customize the failure of the bin when if fails to find the gem to revert to ? (I think that that wrapper bin is created by bundler/rubygems rather than the chromedriver, but I may be wrong here)

Yes, wrappers are generated by rubygems and n there seems to be no way to customize binstub generation there.

This is the code in rubygems where the scripts are generated:

https://github.com/rubygems/rubygems/blob/af9a1a0f4afaf35f712ff1c3b7928150541cdd18/lib/rubygems/installer.rb#L480

https://github.com/rubygems/rubygems/blob/af9a1a0f4afaf35f712ff1c3b7928150541cdd18/lib/rubygems/installer.rb#L736

from chromedriver-helper.

mfazekas avatar mfazekas commented on June 27, 2024

@flavorjones can you explain this note on #58:

Part of the value of chromedriver-helper is that it shadows the system-installed version (and calls it if it's present).

My understanding is that 99% of usecases is just adding the gem to Gemfile and running ui tests, (and this works fine with #58, as it tells capybara the chromedirver path to use). I assume small number of users are starting chromerdirver directly from command line, and i'd argue that for those advanced uses a change in docs is just fine. Or am i missing something?

from chromedriver-helper.

deivid-rodriguez avatar deivid-rodriguez commented on June 27, 2024

Hi! I wanted to report an issue for this ages ago but I never got to it.

I asked the bundler team about this and there's no really a good solution, but a good workaround is to use bundle config --path .bundle so that gems are installed locally to each project and never shared.

But I hadn't thought about the solution proposed by @mfazekas in #57 (comment). That's backwards incompatible, but I think it would make the best behaved chromedriver-helper.

This bug is quite hard to troubleshoot and makes contributing to some projects very painful... 😞

from chromedriver-helper.

deivid-rodriguez avatar deivid-rodriguez commented on June 27, 2024

I fully agree with you @mattbrictson, #58 is the way to go. And as mentioned by @mfazekas, it can be considered backwards incompatible, but it's going to be a transparent change for most users who only use this gem for UI tests. Just note that the bundle config --path .bundle will be the default in bundler 2. I think it's a good move.

from chromedriver-helper.

deivid-rodriguez avatar deivid-rodriguez commented on June 27, 2024

😱 🚒 I did not know that.

Me neither, I just found out too!

Thanks so much for your work @flavorjones! ❤️

from chromedriver-helper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.