We should verify that our new dojo-tagged form example (Demo_Form_v16.html) still works in our automated environment. But Firefox 4.0 no longer have the jssh plugin and firewatir is no longer an option. The watir installation page suggests use of watir-webdriver, which has a runtime dependency on selenium -I’ll have to check this version 2.0 option-.
So we’ll uninstall firewatir and then install watir-webbriver (see detailed install instructions) using the command shell:
$ sudo gem uninstall firewatir $ sudo apt-get install ruby1.8-dev $ sudo gem1.8 install watir-webdriver
Now the ruby definition code needs two modifications that you can see in green in the following code: 1) the require and, 2) instantiation of browser (ff):
#includes require 'rubygems' # optional require 'watir-webdriver' require 'test/unit' class TC_recorded < Test::Unit::TestCase def test_webpage ff = Watir::Browser.new :firefox
Our code won’t run yet, check this for other differences. In our case, our file only needs two more methods to be changed:
- ‘.clearSelection’ is now ‘.clear’ in multiselect
- ‘.contains_text(,)’ in assertion now drops the error text and becomes .text.include?()
Check the final code ‘demo_form.rb‘ that can be run with:
$ ruby demo_form.rb
watir-webdriver seems faster than firewatir and you can test against chrome as well, I like the new tool. Documentation: class list,
Note: Thanks to Al Hoang on a post for fixing ‘mkmf error’ install problem with Ruby on ubuntu, XPlayer for its test article, and Alister Scott for maintaing the watir site.
[Edit May 12th, 2011]
In my Ubuntu 10.04, I just uninstalled Ruby 1.8.7, using synamtic, also installed Ruby 1.9.1 and rubygems andreinstalled rails and click on apply. Result: The watir test works!. So go ahead, upgrade!