Search code examples
rubybundlerwatir

how to update gemfile to only install watir


This is my gemfile:

source 'https://rubygems.org'

gem 'watir', '~> 5.0', '>= 5.0.0' 
gem 'watir-scroll'
gem 'cucumber'
gem 'rspec'
gem 'page-object'
gem 'require_all'
gem 'selenium-webdriver', '~> 2.53', '>= 2.53.1'
gem 'nokogiri', '~> 1.6.8', '>= 1.6.8.1'
gem 'webdriver-user-agent', '~> 7.1'
gem 'headless'
gem 'bundle', '~> 0.0.1'
gem 'appium_lib'
gem 'rake'
gem 'test-unit'

When I execute bundle install with this gemfile, I find watir-webdriver & commonwatir are installed.

I want to only want watir installed. I don't want watir-webdriver or commonwatir installed.

How should I edit my gemfile?

Thanks for your assistance.


Solution

  • Watir v5.0 is the last version of Watir where it was a meta gem for Watir-Webdriver and Watir-Classic. This is where commonwatir and watir-webdriver gems are dependencies. To remove them and only use Watir(-Webdriver), update the Watir gem to be the current 6.x release.

    In other words, change:

    gem 'watir', '~> 5.0', '>= 5.0.0' 
    

    To:

    gem 'watir', '~> 6.0'
    

    You probably should also remove (or at least update) the Selenium-WebDriver requirement. The current version of Watir is not going to work with Selenium-WebDriver v2.x. Given that Watir will already require Selenium, I don't think you need it in your gem file.

    gem 'selenium-webdriver', '~> 2.53', '>= 2.53.1'