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, #hwnd, #initialize, #matches_type?, #new_pid, #search_information, #visible?

Constructor Details

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

Instance Method Details

#exist?Boolean Also known as: exists?

Returns:

  • (Boolean)


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

def exist?
  super && of_type_table?
end

#of_type_table?Boolean

Returns:

  • (Boolean)


115
116
117
# File 'lib/rautomation/adapter/ms_uia/table.rb', line 115

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

#row(locators = {})



79
80
81
# File 'lib/rautomation/adapter/ms_uia/table.rb', line 79

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

#row_count



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

def row_count
  UiaDll::table_row_count search_information
end

#rows(locators = {})



83
84
85
86
87
# File 'lib/rautomation/adapter/ms_uia/table.rb', line 83

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

#select(which_item)



99
100
101
# File 'lib/rautomation/adapter/ms_uia/table.rb', line 99

def select(which_item)
  UiaDll::table_select search_information, which_item
end

#selected?(which_item) ⇒ Boolean

Returns:

  • (Boolean)


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

def selected?(which_item)
  UiaDll::table_row_is_selected search_information, which_item
end

#strings



89
90
91
92
93
94
95
96
97
# File 'lib/rautomation/adapter/ms_uia/table.rb', line 89

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