Class: Druid::Elements::Table

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

Instance Attribute Summary

Attributes inherited from Element

#driver, #element

Instance Method Summary collapse

Methods inherited from Element

#==, #attribute, attribute_expression, build_xpath_for, #clear, #click, #double_click, #enabled?, equal_pair, #exist?, finders, #fire_event, #focus, have_to_build_xpath, identifier_for, identifier_for_element, #initialize, #inspect, lhs_for, mapping, #method_missing, #parent, #right_click, #send_keys, #style, #tag_name, #text, #value, #visible?, #wait_until, #when_not_visible, #when_present, #when_visible, xpath_string

Methods included from Assist

#button_for, #cell_for, #cell_text_for, #check_checkbox, #checkbox_checked?, #checkbox_for, #clear_radio, #click_button_for, #click_link_for, #div_for, #div_text_for, #file_field_for, #file_field_value_set, #form_for, #h1_for, #h1_text_for, #h2_for, #h2_text_for, #h3_for, #h3_text_for, #h4_for, #h4_text_for, #h5_for, #h5_text_for, #h6_for, #h6_text_for, #hidden_field_for, #hidden_field_value_for, #image_for, #link_for, #list_item_for, #list_item_text_for, #ordered_list_for, #paragraph_for, #paragraph_text_for, #radio_button_for, #radio_selected?, #select_list_for, #select_list_value_for, #select_list_value_set, #select_radio, #span_for, #span_text_for, #table_for, #text_area_for, #text_area_value_for, #text_area_value_set, #text_field_for, #text_field_value_for, #text_field_value_set, #uncheck_checkbox, #unordered_list_for

Methods included from NestedElements

#button_element, #cell_element, #checkbox_element, #div_element, #file_field_element, #form_element, #h1_element, #h2_element, #h3_element, #h4_element, #h5_element, #h6_element, #hidden_field_element, #image_element, #link_element, #list_item_element, #ordered_list_element, #paragraph_element, #radio_button_element, #select_list_element, #span_element, #table_element, #text_area_element, #text_field_element, #unordered_list_element

Constructor Details

This class inherits a constructor from Druid::Elements::Element

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Druid::Elements::Element

Instance Method Details

#[](idx) ⇒ Druid::Elements::Table

Return the Druid::Elements::Table for the index provided. Index is zero based.



10
11
12
13
# File 'lib/druid/elements/table.rb', line 10

def [](idx)
  table_row = element[idx]
  Druid::Elements::TableRow.new(table_row)
end

#eachObject



21
22
23
24
25
# File 'lib/druid/elements/table.rb', line 21

def each
  for index in 1..self.rows do
    yield self[index-1]
  end
end

#first_rowObject

return the first row

Returns:

  • Druid::Elements::TableRow



32
33
34
# File 'lib/druid/elements/table.rb', line 32

def first_row
  self[0]
end

#last_rowObject

return the last row

Returns:

  • Druid::Elements::TableRow



41
42
43
# File 'lib/druid/elements/table.rb', line 41

def last_row
  self[-1]
end

#rowsObject

Returns the number of rows in the table.



17
18
19
# File 'lib/druid/elements/table.rb', line 17

def rows
  element.rows.size
end