Class: Watir::TableBody
Overview
this class is a table body
Constant Summary
Constants inherited from Element
Instance Attribute Summary
Attributes inherited from Element
Attributes included from Container
#activeObjectHighLightColor, #page_container, #type_keys, #typingspeed
Instance Method Summary collapse
-
#[](n) ⇒ Object
returns the specified row as a TableRow object.
-
#each ⇒ Object
iterates through all the rows in the table body.
-
#initialize(container, how, what, parent_table = nil) ⇒ TableBody
constructor
A new instance of TableBody.
-
#length ⇒ Object
returns the number of rows in this table body.
- #locate ⇒ Object
Methods inherited from Element
#<=>, #activeObjectHighLightColor, #after_text, #assert_enabled, #assert_exists, #attribute_value, #before_text, #click, #click!, #document, #enabled?, #exists?, #fire_event, #flash, #focus, #inspect, #method_missing, #ole_object, #ole_object=, #parent, #text, #to_s, #type_keys, #typingspeed, #visible?
Methods included from Container
#area, #areas, #button, #buttons, #cell, #cells, #checkbox, #checkboxes, #dds, #divs, #dls, #dts, #element, #element_by_css, #elements, #ems, #file_field, #file_fields, #form, #forms, #frame, #frames, #hidden, #hiddens, #image, #images, #labels, #link, #links, #lis, #locate_all_elements, #locate_input_element, #locate_tagged_element, #log, #map, #maps, #modal_dialog, #popup, #pres, #ps, #radio, #radios, #row, #rows, #select_list, #select_lists, #set_container, #show_all_objects, #spans, #strongs, #table, #tables, #text_field, #text_fields, #wait
Constructor Details
#initialize(container, how, what, parent_table = nil) ⇒ TableBody
Returns a new instance of TableBody.
231 232 233 234 235 236 237 |
# File 'lib/watir/table.rb', line 231 def initialize(container, how, what, parent_table=nil) set_container container @how = how @what = what @parent_table = parent_table super nil end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Watir::Element
Instance Method Details
#[](n) ⇒ Object
returns the specified row as a TableRow object
240 241 242 243 |
# File 'lib/watir/table.rb', line 240 def [](n) assert_exists return @rows[n - 1] end |
#each ⇒ Object
iterates through all the rows in the table body
246 247 248 249 |
# File 'lib/watir/table.rb', line 246 def each locate 0.upto(@rows.length - 1) { |i| yield @rows[i] } end |
#length ⇒ Object
returns the number of rows in this table body.
252 253 254 |
# File 'lib/watir/table.rb', line 252 def length return @rows.length end |
#locate ⇒ Object
216 217 218 219 220 221 222 223 224 225 226 227 228 229 |
# File 'lib/watir/table.rb', line 216 def locate @o = nil if @how == :ole_object @o = @what # in this case, @o is the table body elsif @how == :index @o = @parent_table.bodies.ole_table_body_at_index(@what) end @rows = [] if @o @o.rows.each do |oo| @rows << TableRow.new(@container, :ole_object, oo) end end end |