class RAutomation::Adapter::Autoit::Button
Constants
- DEFAULT_LOCATORS
Default locators used for searching buttons.
- LOCATORS
@private Special-cased locators
Public Class Methods
Creates the button object. @note this method is not meant to be accessed directly, but only through {RAutomation::Window#button}! @param [RAutomation::Window] window this button belongs to. @param [Hash] locators for searching the button. @option locators [String, Regexp] :value Value (text) of the button @option locators [String, Regexp] :class Internal class name of the button @option locators [String, Integer] :id Internal ID of the button @option locators [String, Integer] :index 0-based index to specify n-th button if all other criteria match @see RAutomation::Window#button
# File lib/rautomation/adapter/autoit/button.rb, line 28 def initialize(window, locators) @window = window extract(locators) end
Public Instance Methods
@see RAutomation::Button#click
# 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
@see RAutomation::Button#exists?
# File lib/rautomation/adapter/autoit/button.rb, line 53 def exists? not Window.autoit.ControlGetHandle(@window.locator_hwnd, "", @autoit_locators).empty? end
@see RAutomation::Button#value
# File lib/rautomation/adapter/autoit/button.rb, line 48 def value Window.autoit.ControlGetText(@window.locator_hwnd, "", @autoit_locators) end