Class: RAutomation::Adapter::Autoit::Button
- Inherits:
-
Object
- Object
- RAutomation::Adapter::Autoit::Button
- Includes:
- WaitHelper
- Defined in:
- lib/rautomation/adapter/autoit/button.rb
Constant Summary collapse
- DEFAULT_LOCATORS =
Default locators used for searching buttons.
{:class => /button/i}
Instance Method Summary collapse
- #click
- #exists? ⇒ Boolean
-
#initialize(window, locators) ⇒ Button
constructor
Creates the button object.
- #value
Constructor Details
#initialize(window, locators) ⇒ Button
Note:
this method is not meant to be accessed directly, but only through Window#button!
Creates the button object.
28 29 30 31 |
# File 'lib/rautomation/adapter/autoit/button.rb', line 28 def initialize(window, locators) @window = window extract(locators) end |
Instance Method Details
#click
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/rautomation/adapter/autoit/button.rb', line 34 def click clicked = false wait_until do @window.activate @window.active? && Window.autoit.ControlFocus(@window.locator_hwnd, "", @autoit_locators) == 1 && Window.autoit.ControlClick(@window.locator_hwnd, "", @autoit_locators) == 1 && clicked = true # is clicked at least once block_given? ? yield : clicked && !exists? end end |
#exists? ⇒ Boolean
53 54 55 |
# File 'lib/rautomation/adapter/autoit/button.rb', line 53 def exists? not Window.autoit.ControlGetHandle(@window.locator_hwnd, "", @autoit_locators).empty? end |
#value
48 49 50 |
# File 'lib/rautomation/adapter/autoit/button.rb', line 48 def value Window.autoit.ControlGetText(@window.locator_hwnd, "", @autoit_locators) end |