Class: Watir::TableBodies

Inherits:
Element
  • Object
show all
Defined in:
lib/watir/table.rb

Overview

this class is a collection of the table body objects that exist in the table it wouldnt normally be created by a user, but gets returned by the bodies method of the Table object many of the methods available to this object are inherited from the Element class

Constant Summary

Constants inherited from Element

Element::TO_S_SIZE

Instance Attribute Summary

Attributes inherited from Element

#container

Attributes included from Container

#activeObjectHighLightColor, #page_container, #type_keys, #typingspeed

Instance Method Summary collapse

Methods inherited from Element

#<=>, #activeObjectHighLightColor, #after_text, #assert_enabled, #assert_exists, #attribute_value, #before_text, #click, #click!, #click_no_wait, #document, #enabled?, #exists?, #fire_event, #flash, #focus, #inspect, #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, #elements, #ems, #file_field, #file_fields, #form, #forms, #frame, #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, parent_table) ⇒ TableBodies

Returns a new instance of TableBodies.



181
182
183
184
# File 'lib/watir/table.rb', line 181

def initialize(container, parent_table)
  set_container container
  @o = parent_table     # in this case, @o is the parent table
end

Instance Method Details

#[](n) ⇒ Object

returns the n’th Body as a Watir TableBody object



193
194
195
196
# File 'lib/watir/table.rb', line 193

def []n
  assert_exists
  return TableBody.new(@container, :ole_object, ole_table_body_at_index(n))
end

#eachObject

iterates through each of the TableBodies in the Table. Yields a TableBody object



204
205
206
207
208
# File 'lib/watir/table.rb', line 204

def each
  1.upto(@o.tBodies.length) do |i| 
    yield TableBody.new(@container, :ole_object, ole_table_body_at_index(i))
  end
end

#lengthObject

returns the number of TableBodies that exist in the table



187
188
189
190
# File 'lib/watir/table.rb', line 187

def length
  assert_exists
  return @o.tBodies.length
end

#ole_table_body_at_index(n) ⇒ Object

returns an ole table body



199
200
201
# File 'lib/watir/table.rb', line 199

def ole_table_body_at_index(n)
  return @o.tBodies.item(n-1)
end