简体   繁体   中英

Watir-webdriver in conjunction with java

Is it possible to use watir-webdriver in conjunction with java in jUnit test cases? 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 have written jUnit test cases in which I would like to implement watir-webdriver for scenarious for UI testing.

I`ve read about jruby which allows implement ruby methods into java code and vice versa, but could not find any real life examples how to implement watir webdriver into junit test cases.

Please share your experience!

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 technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM