Class: SK::Row
Instance Attribute Summary collapse
-
#index ⇒ Object
readonly
row is an element that “remembers” it’s index in the table.
Attributes inherited from Element
Instance Method Summary collapse
- #cells ⇒ Object
-
#initialize(locator, index) ⇒ Row
constructor
A new instance of Row.
- #to_s ⇒ Object
Methods inherited from Element
#children, #displayed?, #enabled?, #exists?, #find, #find_child_el, #html, #parent_el, #search, #text
Constructor Details
#initialize(locator, index) ⇒ Row
Returns a new instance of Row.
30 31 32 33 |
# File 'lib/table.rb', line 30 def initialize(locator,index) super(locator) # creates the el and locator @index = index # remember your position end |
Instance Attribute Details
#index ⇒ Object (readonly)
row is an element that “remembers” it’s index in the table
28 29 30 |
# File 'lib/table.rb', line 28 def index @index end |
Instance Method Details
#cells ⇒ Object
35 36 37 38 |
# File 'lib/table.rb', line 35 def cells() ds = self.el.find_elements({tag_name: 'td'}) ds.map.with_index { |e,i| SK::Cell.new(e,i) } end |
#to_s ⇒ Object
40 41 42 43 |
# File 'lib/table.rb', line 40 def to_s text = cells.map { |cell| cell.text }.join("][") "<SK::Row #{@index} [#{text}] >" end |