Quick Search:

Context

Displaying 3 lines either side each change. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace:

Diff

363
 
366
 
366
 
watir.rb
_>3636 #  This is Watir, a web application testing tool for Ruby
 3737 #  Home page is http://wtr.rubyforge.com
 3838 #
<>39 -#  Version "$Revision: 363 $"
  39+#  Version "$Revision: 366 $"
4040 #
 4141 #  Typical usage: 
 4242 #   # include the controller 
     
 !
680680                         table = t
 681681                     end
 682682                 end
<> 683+                tableIndex = tableIndex + 1
683684             end
 684685             #puts "table - #{what}, #{how} Not found " if table ==  nil
 685686             clearFrame()
     
 !
16471648         # This method selects an item, or items in a select box.
 16481649         # Raises NoValueFoundException   if the specified value is not found.
 16491650         #  * item   - the thing to select, string, reg exp or an array of string and reg exps
<>1650 -        
16511651         def select( item )
<> 1652+            select_item_in_select_list( :text , item )
  1653+        end
  1654+
  1655+
  1656+        # This method selects an item, or items in a select box.
  1657+        # Raises NoValueFoundException   if the specified value is not found.
  1658+        #  * item   - the value of the thing to select, string, reg exp or an array of string and reg exps
  1659+        def select_value( item )
  1660+            select_item_in_select_list( :value , item )
  1661+        end
  1662+
  1663+
  1664+
  1665+        # this method is used internally to select something from the select box
  1666+        #  * name  - symbol  :vale or :text - how we find an item in the select box
  1667+        #  * item  - string or reg exp - what we are looking for
  1668+        def select_item_in_select_list( name_or_value, item )
  1669+
16521670             @ieController.clearFrame()
 16531671             raise UnknownObjectException ,  "Unable to locate a selectbox  using #{@how} and #{@what} "  if @o==nil
 16541672             if item.kind_of?( Array ) == false
     
 !
16571675                 items = item 
 16581676             end
 16591677             
<> 1678+            
  1679+
16601680             highLight( :set)
 16611681             doBreak = false
 16621682             items.each do |thisItem|
 16631683                 
 16641684                 @ieController.log "Setting box #{@o.name} to #{thisItem} #{thisItem.class} "
 16651685                 
 16661686                 @o.each do |selectBoxItem|
<>1667 -                    @ieController.log " comparing #{thisItem } to #{selectBoxItem.text}"
 1668 -                    if thisItem.matches( selectBoxItem.text)
  1687+                    @ieController.log " comparing #{thisItem } to #{selectBoxItem.invoke(name_or_value.to_s) }"
  1688+                    if thisItem.matches( selectBoxItem.invoke(name_or_value.to_s))
16691689                         matchedAnItem = true
 16701690                         if selectBoxItem.selected == true
<>1671 -                            @ieController.log " #{selectBoxItem.text} is already selected"
  1691+                            @ieController.log " #{selectBoxItem.invoke(name_or_value.to_s)} is already selected"
16721692                             doBreak = true
 16731693                         else
<>1674 -                            @ieController.log " #{selectBoxItem.text} is being selected"
  1694+                            @ieController.log " #{selectBoxItem.invoke(name_or_value.to_s)} is being selected"
16751695                             selectBoxItem.selected = true
 16761696                             @o.fireEvent("onChange")
 16771697                             doBreak = true
     
 !
16811701                     end
 16821702                 end
 16831703                 
<>1684 -                raise NoValueFoundException , "Selectbox was found, but didnt find item #(item) "   if doBreak == false
  1704+                raise NoValueFoundException , "Selectbox was found, but didnt find item with #{name_or_value.to_s} of #{item} "   if doBreak == false
16851705             end
 16861706             highLight( :clear )
 16871707         end
<> 1708+
  1709+        private :select_item_in_select_list
  1710+
  1711+
  1712+
  1713+
  1714+
  1715+
  1716+
<_16881717         
 16891718         # This method returns all the items in the select list as an array. An empty array is returned if the select box has no contents.
 16901719         # Raises UnknownObjectException if the select box is not found