Class: Mohawk::Adapters::UiaAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/mohawk/adapters/uia_adapter.rb

Instance Method Summary collapse

Constructor Details

#initialize(locator, container = nil) ⇒ UiaAdapter

Returns a new instance of UiaAdapter.



4
5
6
7
8
# File 'lib/mohawk/adapters/uia_adapter.rb', line 4

def initialize(locator, container=nil)
  @only_search_children = locator.delete(:children_only)
  @window = RAutomation::Window.new(locator.merge(:adapter => :ms_uia))
  @container = container
end

Instance Method Details

#button(locator) ⇒ Object



37
38
39
40
# File 'lib/mohawk/adapters/uia_adapter.rb', line 37

def button(locator)
  @buttons ||= {}
  @buttons[locator] ||= Mohawk::Accessors::Button.new(self, merge(locator))
end

#checkbox(locator) ⇒ Object



27
28
29
30
# File 'lib/mohawk/adapters/uia_adapter.rb', line 27

def checkbox(locator)
  @checkbox ||= {}
  @checkbox[locator] ||= Mohawk::Accessors::CheckBox.new(self, merge(locator))
end

#combo(locator) ⇒ Object



21
22
23
24
# File 'lib/mohawk/adapters/uia_adapter.rb', line 21

def combo(locator)
  @combos ||= {}
  @combos[locator] ||= Mohawk::Accessors::Combo.new(self, merge(locator))
end

#label(locator) ⇒ Object



47
48
49
50
# File 'lib/mohawk/adapters/uia_adapter.rb', line 47

def label(locator)
  @labels ||= {}
  @labels[locator] ||= Mohawk::Accessors::Label.new(self, merge(locator))
end


52
53
54
55
# File 'lib/mohawk/adapters/uia_adapter.rb', line 52

def link(locator)
  @links ||= {}
  @links[locator] ||= Mohawk::Accessors::Link.new(self, merge(locator))
end


57
58
59
# File 'lib/mohawk/adapters/uia_adapter.rb', line 57

def menu_item(locator)
  Mohawk::Accessors::MenuItem.new(self, merge(locator))
end

#radio(locator) ⇒ Object



42
43
44
45
# File 'lib/mohawk/adapters/uia_adapter.rb', line 42

def radio(locator)
  @radios ||= {}
  @radios[locator] ||= Mohawk::Accessors::Radio.new(self, merge(locator))
end

#spinner(locator) ⇒ Object



76
77
78
# File 'lib/mohawk/adapters/uia_adapter.rb', line 76

def spinner(locator)
  Mohawk::Accessors::Spinner.new(self, merge(locator))
end

#tab_control(locator) ⇒ Object



80
81
82
# File 'lib/mohawk/adapters/uia_adapter.rb', line 80

def tab_control(locator)
  Mohawk::Accessors::Tabs.new(self, merge(locator))
end

#table(locator) ⇒ Object



61
62
63
64
# File 'lib/mohawk/adapters/uia_adapter.rb', line 61

def table(locator)
  @tables ||= {}
  @tables[locator] ||= Mohawk::Accessors::Table.new(self, merge(locator))
end

#text(locator) ⇒ Object



32
33
34
35
# File 'lib/mohawk/adapters/uia_adapter.rb', line 32

def text(locator)
  @text_fields ||= {}
  @text_fields[locator] ||= Mohawk::Accessors::Text.new(self, merge(locator))
end

#tree_view(locator) ⇒ Object



66
67
68
69
# File 'lib/mohawk/adapters/uia_adapter.rb', line 66

def tree_view(locator)
  @trees ||= {}
  @trees[locator] ||= Mohawk::Accessors::TreeView.new(self, merge(locator))
end

#value_control(locator) ⇒ Object



71
72
73
74
# File 'lib/mohawk/adapters/uia_adapter.rb', line 71

def value_control(locator)
  @controls ||= {}
  @controls[locator] ||= Mohawk::Accessors::Control.new(self, merge(locator))
end

#windowObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/mohawk/adapters/uia_adapter.rb', line 10

def window
  @actual_window ||= begin
    if @container
      control = @window.control(@container)
      RAutomation::WaitHelper.wait_until { control.exist? }
      @window = RAutomation::Window.new(:hwnd => control.hwnd, :adapter => :ms_uia)
    end
    @window
  end
end