Class: RAutomation::Adapter::MsUia::Table

Inherits:
Control
  • Object
show all
Includes:
Locators, WaitHelper
Defined in:
lib/rautomation/adapter/ms_uia/table.rb

Instance Method Summary collapse

Methods inherited from Control

#assert_enabled, #bounding_rectangle, #cached_hwnd, #click, #collapse, #control_class, #control_name, #disabled?, #enabled?, #expand, #focus, #focused?, #get_current_control_type, #help_text, #hwnd, #initialize, #matches_type?, #new_pid, #search_information, #visible?

Constructor Details

This class inherits a constructor from RAutomation::Adapter::MsUia::Control

Instance Method Details

#clear(locators = {})



106
107
108
# File 'lib/rautomation/adapter/ms_uia/table.rb', line 106

def clear(locators={})
  rows(locators).each(&:clear)
end

#exist?Boolean Also known as: exists?

Returns:

  • (Boolean)


128
129
130
# File 'lib/rautomation/adapter/ms_uia/table.rb', line 128

def exist?
  super && of_type_table?
end

#of_type_table?Boolean

Returns:

  • (Boolean)


132
133
134
# File 'lib/rautomation/adapter/ms_uia/table.rb', line 132

def of_type_table?
  matches_type?(Constants::UIA_LIST_CONTROL_TYPE) || matches_type?(Constants::UIA_DATA_GRID_CONTROL_TYPE)
end

#row(locators = {})



92
93
94
# File 'lib/rautomation/adapter/ms_uia/table.rb', line 92

def row(locators={})
  rows(locators).first
end

#row_count



124
125
126
# File 'lib/rautomation/adapter/ms_uia/table.rb', line 124

def row_count
  UiaDll::table_row_count search_information
end

#rows(locators = {})



96
97
98
99
100
# File 'lib/rautomation/adapter/ms_uia/table.rb', line 96

def rows(locators={})
  Rows.new(self, locators).select do |row|
    Row.locators_match? locators, row
  end
end

#select(locators = {})



102
103
104
# File 'lib/rautomation/adapter/ms_uia/table.rb', line 102

def select(locators={})
  rows(locators).each(&:select)
end

#selected_rows



110
111
112
# File 'lib/rautomation/adapter/ms_uia/table.rb', line 110

def selected_rows
  UiaDll.table_selected_indexes(search_information).map {|index| Row.new(self, index: index) }
end

#strings



114
115
116
117
118
119
120
121
122
# File 'lib/rautomation/adapter/ms_uia/table.rb', line 114

def strings
  headers = UiaDll.table_headers(search_information)
  values = UiaDll.table_values(search_information)
  return values if headers.empty?

  all_strings = [] << headers
  values.each_slice(headers.count) {|r| all_strings << r }
  all_strings
end