Is it possible to use Watir WebDriver in conjunction with Java? I have to execute some Java methods for dealing with data in DB in order to simulate different situations and test website UI using watir-webdriver.

I've read about JRuby, but could not find anything about whether it works with Watir WebDriver.

Please share your experience!

  • 1
    Welcome to SQA, mihijs. I do not have any experience with Watir, but a Google search turned up [Watij][watij.com/]. Selenium/Webdriver has a Java API too.
    – user246
    Dec 17 '12 at 14:48
  • "Watir WebDriver in conjunction with Java" == Watij
    – djangofan
    Jun 17 '13 at 22:03
  • This would be a much better question with more context: what has been tried, what resource gaps or functionality gaps are missing, and tie-in to the actual business problem that's occurring.
    – corsiKa
    Mar 11 '14 at 18:23

Instead of searching if Watir works on JRuby, you could have just tried it, like I did:

$ ruby -v
jruby 1.7.1 (1.9.3p327) 2012-12-03 30a153b on Java HotSpot(TM) 64-Bit Server VM 1.6.0_37-b06-434-11M3909 [darwin-x86_64]

$ gem install watir
Successfully installed watir-4.0.2

$ irb

> require "watir"
=> true

> browser = Watir::Browser.new :firefox
=> #<Watir::Browser:0x4fcd5906 url="about:blank" title="">

> browser.goto "google.com"
=> "http://www.google.hr/"

In case it is not clear, Watir works just fine on JRuby.

  • The question was whether it works with Java, not JRuby. The approach itself is fine, though: "just try it!"
    – dzieciou
    Dec 17 '12 at 13:28

Not the answer you're looking for? Browse other questions tagged or ask your own question.