Jen Jen - 1 year ago 103
Ruby Question

Ruby Watir deprecated methods

On installing Ruby & Watir recently to look at the company's web automation project I discovered that a bunch of methods being called have been deprecated. I'm struggling to find a good reference as to what to change the code to.

Is there a good reference (have searched a lot of watir site/manual/faq and not really found what to use instead - especially for the radio button checking if its set). Unless someone can confirm the below.


browser = Watir::Browser.start(strURL)


browser =
browser.goto strURL


.select_list(:id, strHtmlId).getSelectedItems[0].to_s


select_list(:id, strHtmlId).value


radio(:id => strHtmlId).isSet?


radio(:id => strHtmlId).set?

Answer Source

I just came across the watir-classic change log:

It seems to do a pretty good job of highlighting at least the last two changes you mention (see the version 1.6.5 changes). Note that the watir gem that you were likely using before is now the watir-classic gem.

Regarding the first change you mention, that is actually due to the recent watir 4.0 release, which is now a front end for the watir-classic and watir-webdriver gem. You can change the code as you mentioned, or you can require 'watir-classic' instead of require 'watir'. I ran into the same issue with the Browser::attach method and briefly blogged about it on my blog.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download