Class: Symbiont::WebObjects::TableRow
- Includes:
- Enumerable
- Defined in:
- lib/symbiont/web_objects/table_row.rb
Instance Attribute Summary
Attributes inherited from WebObject
Instance Method Summary collapse
-
#[](index) ⇒ Symbiont::WebObjects::TableCell
This method is used to return a TableCell object based on the index provided.
-
#columns ⇒ Object
This method returns the number of columns in a table object.
-
#each ⇒ Symbiont::WebObjects::TableCell
This method is an iterator that returns a TableCell object each time through the loop.
-
#initialize(web_object) ⇒ TableRow
constructor
A new instance of TableRow.
Methods inherited from WebObject
#==, #attribute, #clear, #click, #disabled?, #double_click, #enabled?, #exists?, #fire_event, #flash, #focus, #hover, #html, #id, #inspect, #parent, provide_locator_for, #scroll_into_view, selector_mapping, #send_keys, #style, #tag_name, #text, usable_selectors, #value, #visible?, #wait_until, #when_actionable, #when_not_actionable, #when_not_visible, #when_visible
Constructor Details
#initialize(web_object) ⇒ TableRow
Returns a new instance of TableRow.
7 8 9 |
# File 'lib/symbiont/web_objects/table_row.rb', line 7 def initialize(web_object) @web_object = web_object end |
Instance Method Details
#[](index) ⇒ Symbiont::WebObjects::TableCell
This method is used to return a TableCell object based on the index provided. When the index provided is a string, the text will be matched with the text from the columns in the first row.
15 16 17 18 19 |
# File 'lib/symbiont/web_objects/table_row.rb', line 15 def [](index) index = find_by_title(index) if index.kind_of?(String) return nil unless index && columns >= index + 1 ::Symbiont::WebObjects::TableCell.new(web_object[index]) end |
#columns ⇒ Object
This method returns the number of columns in a table object.
31 32 33 |
# File 'lib/symbiont/web_objects/table_row.rb', line 31 def columns web_object.wd.find_elements(:xpath, cell_xpath).size end |
#each ⇒ Symbiont::WebObjects::TableCell
This method is an iterator that returns a TableCell object each time through the loop.
24 25 26 27 28 |
# File 'lib/symbiont/web_objects/table_row.rb', line 24 def each for index in 1..self.columns do yield self[index - 1] end end |