rubywatir

Ruby & Watir... Web Drivers Conflict


I've downloaded and installed the latest version of Ruby Ruby+Devkit 3.2.2.1(x64) from this link:https://rubyinstaller.org/downloads/

Run the command prompt with Ruby and run:

gem install watir
gem install webdrivers

Run interactive Ruby, and run:

require 'Watir'
require 'webdrivers'

and get an error as below:

C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/specification.rb:2295:in `raise_if_conflicts': Unable to activate webdrivers-5.3.1, because selenium-webdriver-4.13.1 conflicts with selenium-webdriver (~> 4.0, < 4.11) (Gem::ConflictError)
        from C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/specification.rb:1424:in `activate'
        from C:/Ruby32-x64/lib/ruby/3.2.0/rubygems.rb:209:in `rescue in try_activate'
        from C:/Ruby32-x64/lib/ruby/3.2.0/rubygems.rb:202:in `try_activate'
        from <internal:C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:154:in `rescue in require'
        from <internal:C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:39:in `require'
        from (irb):2:in `<main>'
        from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/irb-1.6.2/exe/irb:11:in `<top (required)>'
        from C:/Ruby32-x64/bin/irb:33:in `load'
        from C:/Ruby32-x64/bin/irb:33:in `<main>'
C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/specification.rb:2295:in `raise_if_conflicts': Unable to activate webdrivers-5.3.1, because selenium-webdriver-4.13.1 conflicts with selenium-webdriver (~> 4.0, < 4.11) (Gem::ConflictError)
        from C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/specification.rb:1424:in `activate'
        from C:/Ruby32-x64/lib/ruby/3.2.0/rubygems.rb:203:in `try_activate'
        from <internal:C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:154:in `rescue in require'
        from <internal:C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:39:in `require'
        from (irb):2:in `<main>'
        from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/irb-1.6.2/exe/irb:11:in `<top (required)>'
        from C:/Ruby32-x64/bin/irb:33:in `load'
        from C:/Ruby32-x64/bin/irb:33:in `<main>'
<internal:C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- webdrivers (LoadError)
        from <internal:C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from (irb):2:in `<main>'
        from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/irb-1.6.2/exe/irb:11:in `<top (required)>'
        from C:/Ruby32-x64/bin/irb:33:in `load'
        from C:/Ruby32-x64/bin/irb:33:in `<main>'

What have I done wrong? Literally followed instructions step by step on how to install it...

I tried uninstalling and re-installing Ruby, and then running 'Require Webdrivers' without installing them first, as I thought the conflict might result from some pre-installed drivers from when Ruby was installed, but nothing was called.


Solution

  • Selenium manages drivers directly now (and better than the webdrivers gem does), so you do not need webdrivers gem any more. Remove the requirement and it will just work.

    Discussion of details and reasons can be found here: https://github.com/titusfortner/webdrivers/#update-future-of-this-project