Class: AX::Row

Inherits:
Element show all
Defined in:
lib/ax/row.rb

Overview

UI Element for the row in a table, outline view, etc.

Instance Method Summary collapse

Methods inherited from Element

#==, #actions, #ancestor, #ancestry, #application, #attribute, #attributes, #blank?, #bounds, #children, #description, #initialize, #inspect, #inspect_subtree, #invalid?, #method_missing, #methods, #parameterized_attribute, #parameterized_attributes, #perform, #pid, #respond_to?, #screenshot, #search, #set, #size_of, #to_h, #to_point, #to_s, #type, #writable?

Methods included from Accessibility::PrettyPrinter

#pp_checkbox, #pp_children, #pp_enabled, #pp_focused, #pp_identifier, #pp_position

Constructor Details

This class inherits a constructor from AX::Element

Dynamic Method Handling

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

Instance Method Details

#child_in_column(filters, &block) ⇒ AX::Element

Retrieve the child in a row that corresponds to a specific column. You must pass filters here in the same way that you would for a search or wait.

This is useful for tables where it is difficult to identify which row item is the one you want based on the row items themselves. Often times the columns in the table will have identifying attributes, such as a header, and so you can use this method to figure out what column your row item is in and then the method will return the row item you wanted.

Examples:


rows  = table.rows
total = rows.inject(0) { |sum, row|
  sum += row.child_in_column(header: 'Price').value.to_i
}
puts "The average price is $ #{total / rows.size}"

Raises:


30
31
32
33
34
35
# File 'lib/ax/row.rb', line 30

def child_in_column filters, &block
  qualifier = Accessibility::Qualifier.new(:Column, filters, &block)
  column    = self.parent.columns.index { |x| qualifier.qualifies? x }
  return self.children.at(column) if column
  raise Accessibility::SearchFailure.new(self.parent, 'column', filters, &block)
end