1
votes

I have Ruby 2.2.2, I have already watir-webdriver gem installed, when I run following script

require 'rubygems'
require 'watir-webdriver'
browser = Watir::Browser.new :firefox

It gives in

`require': cannot load such file -- watir-webdriver(LoadError)
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'

I have rubymine 7.1.2

Here is my gem list

$ gem list

* LOCAL GEMS *

bigdecimal (1.2.6) bundler (1.10.3) bundler-unload (1.0.2) childprocess (0.5.6) executable-hooks (1.3.2) ffi (1.9.8) gem-wrappers (1.2.7) io-console (0.4.3) json (1.8.1) multi_json (1.11.1) psych (2.0.8) rake (10.4.2) rdoc (4.2.0) rubygems-bundler (1.4.4) rubyzip (1.1.7) rvm (1.11.3.9) selenium-webdriver (2.46.2) watir-webdriver (0.7.0) websocket (1.2.2) yard (0.8.7.6)

Please suggest what to do?

1
Did you try to opened irb in terminal and require 'watir-webdriver' without any other gems?Alex Holubenko
it's interesting, you say that you have ruby v. 2.2.2, but, log of your error say that it was searching in directory ruby 2.0.0, can you use command: ruby -v and add here what it show?Alex Holubenko
Janhavis-MacBook-Pro:~ janhavideshpande$ ruby -v ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]Janhavi

1 Answers

0
votes

/System/Library/Frameworks/Ruby.framework/Versions/2.0/... is the system library in OS X Yosemite.

Ruby 2.2 (or any other version) is installed by you or some other user -- perhaps via RVM, given you have some rvm gem installed? If so you need to use RVM to change the default. If you did not install RVM correctly or ignored some warning or command it gave to you, you might want to re-install.

If you did not install Ruby 2.2 via RVM*, here are instructions for changing OS X default Ruby installed using Brew.

(*I could not recommend RVM more strongly. Other people like rbenv to do the same job.)