Make sure watir
gem is installed correctly. You can do it like this:
gem install watir
Ignore the other answers here which say that you should not install watir
- it is perfectly normal to install watir
since this is a meta gem, which will load watir-webdriver
or watir-classic
as needed.
And then in your code, do like this:
require "watir"
b = Watir::Browser.new :chrome # loads watir-webdriver and opens up a Chrome browser
However, if you do not specify the browser, then default will be used for current platform.
# on Windows
b = Watir::Browser.new # loads watir-classic and opens up an IE browser
# on unix
b = Watir::Browser.new # loads watir-webdriver and opens up a Firefox browser
In other words - using a watir
gem is perfectly normal even if you'd like to use watir-webdriver
underneath it because you can switch the drivers really easily.
You can read more from the watir
readme.