Class: RAutomation::Adapter::Autoit::TextField
- Inherits:
-
Object
- Object
- RAutomation::Adapter::Autoit::TextField
- Includes:
- WaitHelper
- Defined in:
- lib/rautomation/adapter/autoit/text_field.rb
Constant Summary collapse
- DEFAULT_LOCATORS =
Default locators used for searching text fields.
{:class => /edit/i}
Instance Method Summary collapse
- #clear
- #exists? ⇒ Boolean
-
#initialize(window, locators) ⇒ TextField
constructor
Creates the text field object.
- #set(text)
- #value
Constructor Details
#initialize(window, locators) ⇒ TextField
Note:
this method is not meant to be accessed directly, but only through Window#text_field!
Creates the text field object.
28 29 30 31 |
# File 'lib/rautomation/adapter/autoit/text_field.rb', line 28 def initialize(window, locators) @window = window extract(locators) end |
Instance Method Details
#clear
45 46 47 |
# File 'lib/rautomation/adapter/autoit/text_field.rb', line 45 def clear set "" end |
#exists? ⇒ Boolean
55 56 57 |
# File 'lib/rautomation/adapter/autoit/text_field.rb', line 55 def exists? not Window.autoit.ControlGetHandle(@window.locator_hwnd, "", @autoit_locators).empty? end |
#set(text)
34 35 36 37 38 39 40 41 42 |
# File 'lib/rautomation/adapter/autoit/text_field.rb', line 34 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 |
#value
50 51 52 |
# File 'lib/rautomation/adapter/autoit/text_field.rb', line 50 def value Window.autoit.ControlGetText(@window.locator_hwnd, "", @autoit_locators) end |