I have installed Ruby 2, devkit & Watir.
when I running a simple script:
require 'rubygems'
require 'watir'
require 'watir-webdriver'
ie = Watir::IE.new
ie.goto("http://www.google.com")
I am getting the following error:
uninitialized constant Watir::IE (NameError)
then I tried ie = Watir::Browser.new
instead of ie = Watir::IE.new
still getting error:
cannot load such file watir-classic (loaderror)
then I tried installing watir-classic, getting error again:
extconf.rb
libxml2 is missing
Can anyone please help me resolve this issue?
Based on the error, my guess is that watir-classic is failing to install the nokogiri gem. Nokogiri does not currently support Ruby x64 on Windows - see https://github.com/sparklemotion/nokogiri/issues/864.
Two things you could try:
Use 32bit Ruby (as suggested in the Nokogiri issue)
Use a browser other than IE. By default, Browser.new
will start IE using watir-classic. Using one of the other browsers will use watir-webdriver, which I do not believe is dependent on nokogiri.
Example:
require 'watir'
browser = Watir::Browser.new :chrome
browser.goto("http://www.google.com")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With