Module: Mohawk
- Extended by:
- Waiter
- Includes:
- Waiter
- Defined in:
- lib/mohawk.rb,
lib/mohawk/waiter.rb,
lib/mohawk/win_32.rb,
lib/mohawk/version.rb,
lib/mohawk/accessors.rb,
lib/mohawk/navigation.rb,
lib/mohawk/adapters/uia/radio.rb,
lib/mohawk/adapters/uia/table.rb,
lib/mohawk/adapters/uia/button.rb,
lib/mohawk/adapters/uia/window.rb,
lib/mohawk/adapters/uia/control.rb,
lib/mohawk/adapters/uia/spinner.rb,
lib/mohawk/adapters/uia_adapter.rb,
lib/mohawk/adapters/uia/checkbox.rb,
lib/mohawk/adapters/uia/text_box.rb,
lib/mohawk/adapters/uia/menu_item.rb,
lib/mohawk/adapters/uia/table_row.rb,
lib/mohawk/adapters/uia/tree_view.rb,
lib/mohawk/adapters/uia/select_list.rb,
lib/mohawk/adapters/uia/tab_control.rb,
lib/mohawk/adapters/uia/value_control.rb,
lib/mohawk/adapters/uia/element_locator.rb
Defined Under Namespace
Modules: Accessors, Adapters, Navigation, Waiter, Win32 Classes: InvalidApplicationPath
Constant Summary collapse
- VERSION =
"0.4.1"
Class Attribute Summary collapse
-
.default_adapter ⇒ Object
Returns the value of attribute default_adapter.
-
.timeout ⇒ Object
Returns the value of attribute timeout.
Instance Attribute Summary collapse
-
#adapter ⇒ Object
readonly
Returns the value of attribute adapter.
Class Method Summary collapse
Instance Method Summary collapse
-
#active? ⇒ Boolean
Returns whether or not the window is active.
-
#exist? ⇒ Boolean
Returns whether or not the window exists.
-
#has_text?(text_to_find) ⇒ Boolean
Indicates if the window has text or not.
- #initialize(extra = {}) ⇒ Object
-
#present? ⇒ Boolean
Returns whether or not the window is present.
-
#wait_for_control(locator) ⇒ Object
Waits until a control exists.
-
#wait_until_present ⇒ Object
Waits until the window is present.
Methods included from Waiter
Class Attribute Details
.default_adapter ⇒ Object
Returns the value of attribute default_adapter.
50 51 52 |
# File 'lib/mohawk.rb', line 50 def default_adapter @default_adapter end |
.timeout ⇒ Object
Returns the value of attribute timeout.
49 50 51 |
# File 'lib/mohawk.rb', line 49 def timeout @timeout end |
Instance Attribute Details
#adapter ⇒ Object (readonly)
Returns the value of attribute adapter.
25 26 27 |
# File 'lib/mohawk.rb', line 25 def adapter @adapter end |
Class Method Details
.app ⇒ Object
40 41 42 |
# File 'lib/mohawk.rb', line 40 def self.app @app end |
.app_path=(path) ⇒ Object
44 45 46 |
# File 'lib/mohawk.rb', line 44 def self.app_path=(path) @app_path = path end |
.included(cls) ⇒ Object
21 22 23 |
# File 'lib/mohawk.rb', line 21 def self.included(cls) cls.extend Mohawk::Accessors end |
.start ⇒ Object
27 28 29 30 31 32 |
# File 'lib/mohawk.rb', line 27 def self.start raise InvalidApplicationPath.new unless @app_path @app = ChildProcess.build(@app_path).start wait_until { Uia.find_element pid: @app.pid } end |
.stop ⇒ Object
34 35 36 37 38 |
# File 'lib/mohawk.rb', line 34 def self.stop raise 'An application was never started' unless @app @app.stop unless @app.exited? @app = nil end |
Instance Method Details
#active? ⇒ Boolean
Returns whether or not the window is active
78 79 80 |
# File 'lib/mohawk.rb', line 78 def active? adapter.window.active? end |
#exist? ⇒ Boolean
Returns whether or not the window exists
71 72 73 |
# File 'lib/mohawk.rb', line 71 def exist? adapter.window.exist? end |
#has_text?(text_to_find) ⇒ Boolean
Indicates if the window has text or not
111 112 113 |
# File 'lib/mohawk.rb', line 111 def has_text?(text_to_find) adapter.window.text.include? text_to_find end |
#initialize(extra = {}) ⇒ Object
62 63 64 65 66 |
# File 'lib/mohawk.rb', line 62 def initialize(extra={}) locator = [which_window.merge(extra)] locator << parent_container if respond_to?(:parent_container) @adapter = Mohawk.default_adapter.new(*locator) end |
#present? ⇒ Boolean
Returns whether or not the window is present
85 86 87 |
# File 'lib/mohawk.rb', line 85 def present? adapter.window.present? end |
#wait_for_control(locator) ⇒ Object
Waits until a control exists
99 100 101 102 103 104 105 106 |
# File 'lib/mohawk.rb', line 99 def wait_for_control(locator) control = adapter.control(locator) begin wait_until { control.exist? } rescue raise "A control with #{locator} was not found" end end |
#wait_until_present ⇒ Object
Waits until the window is present
92 93 94 |
# File 'lib/mohawk.rb', line 92 def wait_until_present adapter.window.wait_until_present end |