Class: Mohawk::Adapters::UIA::Table

Inherits:
Control
  • Object
show all
Includes:
Enumerable, ElementLocator
Defined in:
lib/mohawk/adapters/uia/table.rb

Instance Method Summary collapse

Methods inherited from Control

#click, #disabled?, #enabled?, #exist?, #focus, #handle, #initialize, #method_missing, valid_patterns, #value, #view, #visible?

Methods included from Waiter

#wait_until

Constructor Details

This class inherits a constructor from Mohawk::Adapters::UIA::Control

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Mohawk::Adapters::UIA::Control

Instance Method Details

#[](index) ⇒ Object



24
25
26
# File 'lib/mohawk/adapters/uia/table.rb', line 24

def [](index)
  row_at(index)
end

#add(which) ⇒ Object



12
13
14
# File 'lib/mohawk/adapters/uia/table.rb', line 12

def add(which)
  find_row_with(which).add
end

#clear(which) ⇒ Object



16
17
18
# File 'lib/mohawk/adapters/uia/table.rb', line 16

def clear(which)
  find_row_with(which).clear
end

#eachObject



28
29
30
# File 'lib/mohawk/adapters/uia/table.rb', line 28

def each
  all_items.each { |row| yield row }
end

#elementObject



43
44
45
# File 'lib/mohawk/adapters/uia/table.rb', line 43

def element
  super.as(:table)
end

#find_row_with(row_info) ⇒ Object



32
33
34
35
36
37
38
39
40
41
# File 'lib/mohawk/adapters/uia/table.rb', line 32

def find_row_with(row_info)
  found_row = case row_info
                when Hash
                  find_by_hash(row_info)
                else
                  find_element(row_info)
              end
  raise "A row with #{row_info} was not found" unless found_row
  found_row
end

#headersObject



20
21
22
# File 'lib/mohawk/adapters/uia/table.rb', line 20

def headers
  element.headers.map &:name
end

#select(which) ⇒ Object



8
9
10
# File 'lib/mohawk/adapters/uia/table.rb', line 8

def select(which)
  find_row_with(which).select
end