I am a newbie in WATIR. The problem I am facing is - The application I am testing has thumbnails (like Windows icons) placed on the page and I need to double click it. On do
There's one elegant solution I did for Watir 1.6.7 in Windows.
I went to ruby/lib/ruby/gems/1.8/gems/watir-1.6.7/lib/watir/element.rb (your path may change, but the main idea is to access the watir library and modify the element.rb file).
I added these lines:
def fire_event_no_wait(event)
assert_exists
assert_enabled
highlight(:set)
element = "#{self.class}.new(#{@page_container.attach_command}, :unique_number, # {self.unique_number})"
ruby_code = "require 'rubygems';" <<
"require '#{File.expand_path(File.dirname(__FILE__))}/core';" <<
"#{element}.fire_event(\"#{event}\")"
system(spawned_click_no_wait_command(ruby_code))
highlight(:clear)
end
this will create a method called fire_event_no_wait that behaves just like click_no_wait in watir.
Hope this helps anyone out.