Module: Mohawk

Defined in:
lib/mohawk.rb,
lib/mohawk/version.rb,
lib/mohawk/accessors.rb,
lib/mohawk/navigation.rb,
lib/mohawk/accessors/link.rb,
lib/mohawk/accessors/text.rb,
lib/mohawk/accessors/combo.rb,
lib/mohawk/accessors/label.rb,
lib/mohawk/accessors/radio.rb,
lib/mohawk/accessors/table.rb,
lib/mohawk/accessors/button.rb,
lib/mohawk/accessors/control.rb,
lib/mohawk/accessors/checkbox.rb,
lib/mohawk/accessors/menu_item.rb,
lib/mohawk/accessors/table_row.rb,
lib/mohawk/accessors/tree_view.rb,
lib/mohawk/adapters/uia_adapter.rb

Defined Under Namespace

Modules: Accessors, Adapters, Navigation

Constant Summary collapse

VERSION =
"0.0.4"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#adapterObject (readonly)

Returns the value of attribute adapter.



13
14
15
# File 'lib/mohawk.rb', line 13

def adapter
  @adapter
end

Class Method Details

.included(cls) ⇒ Object



15
16
17
# File 'lib/mohawk.rb', line 15

def self.included(cls)
  cls.extend Mohawk::Accessors
end

Instance Method Details

#active?Boolean

Returns whether or not the window is active

Returns:

  • (Boolean)


35
36
37
# File 'lib/mohawk.rb', line 35

def active?
  adapter.window.active?
end

#exist?Boolean

Returns whether or not the window exists

Returns:

  • (Boolean)


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

def exist?
  adapter.window.exist?
end

#has_text?(text_to_find) ⇒ Boolean

Indicates if the window has text or not

Returns:

  • (Boolean)


75
76
77
# File 'lib/mohawk.rb', line 75

def has_text?(text_to_find)
  adapter.window.text.include? text_to_find
end

#initialize(extra = {}) ⇒ Object



19
20
21
22
23
# File 'lib/mohawk.rb', line 19

def initialize(extra={})
  locator = [which_window.merge(extra)]
  locator << parent_container if respond_to?(:parent_container)
  @adapter = Mohawk::Adapters::UiaAdapter.new(*locator)
end

#present?Boolean

Returns whether or not the window is present

Returns:

  • (Boolean)


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

def present?
  adapter.window.present?
end

#wait_for_control(locator) ⇒ Object

Waits until a control exists



56
57
58
59
60
61
62
63
# File 'lib/mohawk.rb', line 56

def wait_for_control(locator)
  control = adapter.window.control(locator)
  begin
    RAutomation::WaitHelper.wait_until { control.exist? }
  rescue
    raise "A control with #{locator} was not found"
  end
end

#wait_until(timeout = RAutomation::Window.wait_timeout, &block) ⇒ Object

Waits until the block returns true



68
69
70
# File 'lib/mohawk.rb', line 68

def wait_until(timeout=RAutomation::Window.wait_timeout, &block)
  RAutomation::WaitHelper.wait_until timeout, &block
end

#wait_until_presentObject

Waits until the window is present



49
50
51
# File 'lib/mohawk.rb', line 49

def wait_until_present
  adapter.window.wait_until_present
end