Sha256: 724f100ac898ad20afa6cb85e1c0100b19a454ec71cf89c36bdecfb30d842f51
Contents?: true
Size: 1.94 KB
Versions: 3
Compression:
Stored size: 1.94 KB
Contents
module RAutomation module Adapter module Autoit class Button include WaitHelper include Locators # @private # Special-cased locators LOCATORS = { [:class, Regexp] => :regexpclass, :index => :instance, :value => :text } # 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, Fixnum] :id Internal ID of the button # @option locators [String, Fixnum] :index 0-based index to specify n-th button if all other criteria match # @see RAutomation::Window#button def initialize(window, locators) @window = window extract(locators) end # @see RAutomation::Button#click def click clicked = false wait_until do @window.activate @window.active? && Window.autoit.ControlFocus(@window.locator_hwnd, "", @locators) == 1 && Window.autoit.ControlClick(@window.locator_hwnd, "", @locators) == 1 && clicked = true # is clicked at least once clicked && !exists? end end # @see RAutomation::Button#value def value Window.autoit.ControlGetText(@window.locator_hwnd, "", @locators) end # @see RAutomation::Button#exists? def exists? not Window.autoit.ControlGetHandle(@window.locator_hwnd, "", @locators).empty? end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rautomation-0.3.0 | lib/rautomation/adapter/autoit/button.rb |
rautomation-0.2.1 | lib/rautomation/adapter/autoit/button.rb |
rautomation-0.2.0 | lib/rautomation/adapter/autoit/button.rb |