Module: Fluent::Platforms::WatirWebDriver::TableRow

Defined in:
lib/fluent/platform_watir/platform_web_elements/table_row.rb

Instance Method Summary collapse

Instance Method Details

#[](index) ⇒ Fluent::WebElements::Cell



7
8
9
10
11
# File 'lib/fluent/platform_watir/platform_web_elements/table_row.rb', line 7

def [](index)
  index = find_by_title(index) if index.kind_of?(String)
  return nil unless index && columns >= index + 1
  ::Fluent::WebElements::Cell.new(web_element[index], :platform => :watir_webdriver)
end

#columnsObject



13
14
15
# File 'lib/fluent/platform_watir/platform_web_elements/table_row.rb', line 13

def columns
  web_element.wd.find_elements(:xpath, cell_xpath).size
end

#find_by_title(column_text) ⇒ Object



17
18
19
20
21
22
# File 'lib/fluent/platform_watir/platform_web_elements/table_row.rb', line 17

def find_by_title(column_text)
  table = web_element.parent
  table = table.parent if table.tag_name == 'tbody'
  first_row = table[0]
  first_row.cells.find_index {|column| column.text.include? column_text}
end