1

When I try to open/attach to an IE browser, I am getting the below error. I have the Watir gem installed in my system, but still I am facing the below error. Earlier, they were no issues when I tried to open the IE browser.

irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'watir'
=> true
irb(main):003:0> include Watir
=> Object
irb(main):004:0> @ie=Watir::IE.new
NameError: uninitialized constant Watir::IE
        from (irb):4

My system configurations:

Windows-7
IE-8
orde
  • 5,233
  • 6
  • 31
  • 33
khan
  • 547
  • 3
  • 18
  • 1
    What changed between when this worked and when it stopped? Did you upgrade your version of Watir? – Justin Ko Mar 03 '15 at 16:52
  • 1
    yep justin just now I installed watir-webdriver-performance as well as updated the gems due to which I got Watir(5.0.0) installed prior to watir(1.6.7) – khan Mar 03 '15 at 16:56
  • unless you are doing something really unusual you should only need to require watir, not include it – Chuck van der Linden Mar 12 '15 at 03:35

1 Answers1

0

Watir::IE has been deprecated in the newer versions of Watir (Classic). In the current version of Watir (Classic and Webdriver), it needs to be Watir::Browser.

In other words:

@ie = Watir::Browser.new
Justin Ko
  • 46,526
  • 5
  • 91
  • 101
  • even I tried with the above syntax but I got the following error LoadError: no such file to load -- watir-classic from C:/svn/ruby/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require .rb:121:in `gem_original_require'from C:/svn/ruby/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require .rb:121:in `require'from C:/svn/ruby/lib/ruby/gems/1.8/gems/watir-5.0.0/lib/watir/loader.rb: 41:in `load_driver' from C:/svn/ruby/lib/ruby/gems/1.8/gems/watir-5.0.0/lib/watir/loader.rb: 33:in `load_driver_for'from C:/svn/ruby/lib/ruby/gems/1.8/gems/watir-5.0.0/lib/watir/loader.rb: 6:in `initia – khan Mar 03 '15 at 17:03
  • Can you check your list of installed gems, `gem list`, to see if you have Watir-Classic installed? It should have been installed when installing Watir, but it sounds like it was not. – Justin Ko Mar 03 '15 at 17:06
  • I dont have watir-classic installed in my system currently I have Watir(5.0.0,1.6.7) versions installed so which version of watir-classic u want me to installed – khan Mar 03 '15 at 17:08
  • 1
    Fetching: mini_portile-0.6.2.gem (100%) Successfully installed mini_portile-0.6.2 Fetching: nokogiri-1.6.6.2.gem (100%) ERROR: Error installing watir-classic: nokogiri requires Ruby version >= 1.9.2.,I got the error while installing watir-classic – khan Mar 03 '15 at 17:14
  • I guess the question is what is your goal? Are you trying to get the latest version of Watir-Classic (ie the newest version of Watir v1.6.7) or are you trying to switch to Watir-Webdriver's IE? – Justin Ko Mar 03 '15 at 17:22
  • I want it to waork as earlier as we use to open the browser @ie=Watir::IE.new – khan Mar 03 '15 at 17:24
  • Then I would suggest installing the newest version of Watir-Classic. It looks like one of its dependencies, Nokogiri needs you to also install a version of Ruby that is greater than 1.9.2. If you do not want to upgrade Ruby, you could try manually installing an older version of Nokogiri that is compatible with Ruby 1.8. – Justin Ko Mar 03 '15 at 17:34
  • nokogiri -v 1.5.10 I have installed nokogiri 1.5.10 which is compatible with the ruby 1.8.7 but still I am facing the similar issue – khan Mar 03 '15 at 18:55
  • Similar issue... meaning which issue? – Justin Ko Mar 03 '15 at 18:58
  • Unintialized constant if i use 'IE' where as load error issue if I use 'Browser' – khan Mar 03 '15 at 19:15
  • LoadError: no such file to load -- watir-classic from C:/svn/ruby/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require .rb:121:in `gem_original_require' from C:/svn/ruby/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require .rb:121:in `require' from C:/svn/ruby/lib/ruby/gems/1.8/gems/watir-5.0.0/lib/watir/loader.rb: 41:in `load_driver' from C:/svn/ruby/lib/ruby/gems/1.8/gems/watir-5.0.0/lib/watir/loader.rb: 33:in `load_driver_for' from C:/svn/ruby/lib/ruby/gems/1.8/gems/watir-5.0.0/lib/watir/loader.rb: 6:in `initialize' from (irb):5:in `new' – khan Mar 03 '15 at 19:15
  • It still sounds like you have not installed Watir-Classic. – Justin Ko Mar 03 '15 at 19:26
  • C:\Users\>gem install watir-classic Building native extensions. This could take a while... ERROR: Error installing watir-classic: ERROR: Failed to build gem native extension. creating extconf.h creating Makefilenmake clean'nmake' is not recognized as an internalor external command,operable program or batch file.nmake 'nmake' is not recognized as an internal or external command, operable program or batch file. make failed,while trying to install the watir-classic I got the above mention error – khan Mar 03 '15 at 19:45
  • 2
    There are a number of StackOverflow questions with this error. Have you tried some of their answers? The most common answer seems to suggest you are missing the Ruby Development Kit. – Justin Ko Mar 03 '15 at 20:31
  • Hey @ Justin Ko I have gone through some of the questions on stackoverfflow but couldn't resolve it can u suggest ........ – khan Mar 07 '15 at 17:43
  • Actually I have installed the Ruby through the svn checkout is it possible to download the ruby development kit ........ – khan Mar 07 '15 at 17:48
  • You can get it from the [RubyInstaller for Window's page](http://rubyinstaller.org/downloads/). – Justin Ko Mar 09 '15 at 12:57
  • yeah you need devkit See the answers to this question http://stackoverflow.com/q/8100891/409820 – Chuck van der Linden Mar 12 '15 at 03:39