Index: watir.rb =================================================================== --- watir.rb (revision 1163) +++ watir.rb (working copy) @@ -2570,18 +2570,27 @@ # This method clicks the active element. # raises: UnknownObjectException if the object is not found # ObjectDisabledException if the object is currently disabled - def click - click! - @container.wait + def click(*args) + args_hash = Hash.new + args.each do |arg| + arg.each_pair{|key, value| args_hash[key] = value } + end + + unless args_hash[:triggers_modal] + click! + else + assert_enabled + highlight(:set) + object = "#{self.class}.new(self, :unique_number, #{self.unique_number})" + @page_container.eval_in_spawned_process(object + ".click!") + highlight(:clear) + end + + @container.wait unless args_hash[:wait] == false end def click_no_wait - assert_enabled - - highlight(:set) - object = "#{self.class}.new(self, :unique_number, #{self.unique_number})" - @page_container.eval_in_spawned_process(object + ".click!") - highlight(:clear) + click(:triggers_modal => true) end def click! @@ -4100,7 +4109,12 @@ # set the file location in the Choose file dialog in a new process # will raise a Watir Exception if AutoIt is not correctly installed - def set(setPath) + def set(setPath, *args) + args_hash = Hash.new + args.each do |arg| + arg.each_pair{|key, value| args_hash[key] = value } + end + assert_exists require 'watir/windowhelper' WindowHelper.check_autoit_installed @@ -4112,7 +4126,11 @@ rescue raise Watir::Exception::WatirException, "Problem accessing Choose file dialog" end - click + unless args_hash[:wait] + click(:wait => false) + else + click + end end end @@ -4559,4 +4577,4 @@ "temp = Array.new(#{array.inspect}); #{name}.clear; temp.each {|element| #{name} << element}" end -require 'watir/camel_case' \ No newline at end of file +require 'watir/camel_case'