Class: RAutomation::Adapter::MsUia::Row

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table, locators) ⇒ Row

Returns a new instance of Row.



44
45
46
47
48
# File 'lib/rautomation/adapter/ms_uia/table.rb', line 44

def initialize(table, locators)
  @table = table
  @search_information = table.search_information
  @locators = extract(locators)
end

Instance Attribute Details

#search_information (readonly)

Returns the value of attribute search_information.



30
31
32
# File 'lib/rautomation/adapter/ms_uia/table.rb', line 30

def search_information
  @search_information
end

Class Method Details

.locators_match?(locators, item) ⇒ Boolean

Returns:

  • (Boolean)


74
75
76
77
78
79
# File 'lib/rautomation/adapter/ms_uia/table.rb', line 74

def self.locators_match?(locators, item)
  locators.all? do |locator, value|
    return item.value =~ value if value.is_a? Regexp
    return item.send(locator) == value
  end
end

Instance Method Details

#cell(locators = {})



40
41
42
# File 'lib/rautomation/adapter/ms_uia/table.rb', line 40

def cell(locators={})
  cells(locators).first
end

#cells(locators = {})



34
35
36
37
38
# File 'lib/rautomation/adapter/ms_uia/table.rb', line 34

def cells(locators={})
  Cells.new(self, locators).select do |cell|
    Row.locators_match? locators, cell
  end
end

#clear



62
63
64
# File 'lib/rautomation/adapter/ms_uia/table.rb', line 62

def clear
  UiaDll::table_remove_from_selection search_information, row
end

#exists?Boolean

Returns:

  • (Boolean)


70
71
72
# File 'lib/rautomation/adapter/ms_uia/table.rb', line 70

def exists?
  @locators[:index].between? 0, @table.row_count - 1
end

#index Also known as: row



50
51
52
# File 'lib/rautomation/adapter/ms_uia/table.rb', line 50

def index
  @locators[:index] || 0
end

#select



54
55
56
# File 'lib/rautomation/adapter/ms_uia/table.rb', line 54

def select
  UiaDll::table_select search_information, row
end

#selected?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/rautomation/adapter/ms_uia/table.rb', line 58

def selected?
  UiaDll::table_row_is_selected search_information, row
end

#value Also known as: text



66
67
68
# File 'lib/rautomation/adapter/ms_uia/table.rb', line 66

def value
  UiaDll::table_value_at search_information, @locators[:index]
end