Index: watir.rb =================================================================== --- watir.rb (revision 1163) +++ watir.rb (working copy) @@ -255,6 +255,14 @@ end" end + def args_to_hash(args) + args_hash = Hash.new + args.each do |arg| + arg.each_pair{|key, value| args_hash[key] = value } + end + args_hash + end + # # Factory Methods # @@ -1683,9 +1691,14 @@ # Navigate to the specified URL. # * url - string - the URL to navigate to - def goto(url) + # + # Optional arguments: + # :wait => false - script will not wait for page-load before next action + def goto(url, *args) + args_hash = args_to_hash(args) + @ie.navigate(url) - wait + wait unless args_hash[:wait] == false return @down_load_time end @@ -2570,18 +2583,28 @@ # 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 + # + # Optional arguments: + # :wait => false - script will not wait for page-load before next action + # :triggers_modal => true - click will occur in a separate process + def click(*args) + args_hash = args_to_hash(args) + + 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 +4123,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) + # + # Optional arguments: + # :wait => false - script will not wait for page-load before next action + def set(setPath, *args) + args_hash = args_to_hash(args) + assert_exists require 'watir/windowhelper' WindowHelper.check_autoit_installed @@ -4112,7 +4140,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 +4591,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'