class RAutomation::Adapter::Autoit::TextField
Constants
- DEFAULT_LOCATORS
Default locators used for searching text fields.
- LOCATORS
@private Special-cased locators
Public Class Methods
Creates the text field object. @note this method is not meant to be accessed directly, but only through {RAutomation::Window#text_field}! @param [RAutomation::Window] window this text field belongs to. @param [Hash] locators for searching the text field. @option locators [String, Regexp] :class Internal class name of the text field @option locators [String, Regexp] :value Value (text) of the text field @option locators [String, Integer] :id Internal ID of the text field @option locators [String, Integer] :index 0-based index to specify n-th text field if all other criteria match @see RAutomation::Window#text_field
# File lib/rautomation/adapter/autoit/text_field.rb, line 28 def initialize(window, locators) @window = window extract(locators) end
Public Instance Methods
@see RAutomation::TextField#clear
# File lib/rautomation/adapter/autoit/text_field.rb, line 49 def clear set "" end
@see RAutomation::TextField#exists?
# File lib/rautomation/adapter/autoit/text_field.rb, line 59 def exists? hwnd != 0 end
# File lib/rautomation/adapter/autoit/text_field.rb, line 33 def hwnd Window.autoit.ControlGetHandle(@window.locator_hwnd, "", @autoit_locators).hex end
@see RAutomation::TextField#set
# File lib/rautomation/adapter/autoit/text_field.rb, line 38 def set(text) wait_until do @window.activate @window.active? && Window.autoit.ControlFocus(@window.locator_hwnd, "", @autoit_locators) == 1 && Window.autoit.ControlSetText(@window.locator_hwnd, "", @autoit_locators, text) == 1 && value == text end end
@see RAutomation::TextField#value
# File lib/rautomation/adapter/autoit/text_field.rb, line 54 def value Window.autoit.ControlGetText(@window.locator_hwnd, "", @autoit_locators) end