Class: RAutomation::Adapter::WinFfi::TextField
- Inherits:
-
Control
- Object
- Control
- RAutomation::Adapter::WinFfi::TextField
show all
- Includes:
- WaitHelper
- Defined in:
- lib/rautomation/adapter/win_ffi/text_field.rb
Constant Summary
collapse
- DEFAULT_LOCATORS =
Default locators used for searching text fields.
{:class => /edit/i}
Instance Method Summary
collapse
Methods inherited from Control
#assert_enabled, #click, #disabled?, #enabled?, #has_focus?, #initialize, #matches_type, #set_focus, #uia_control
Instance Method Details
#clear
26
27
28
29
|
# File 'lib/rautomation/adapter/win_ffi/text_field.rb', line 26
def clear
raise "Cannot set value on a disabled text field" if disabled?
set ""
end
|
#exist? ⇒ Boolean
Also known as:
exists?
41
42
43
|
# File 'lib/rautomation/adapter/win_ffi/text_field.rb', line 41
def exist?
@locators[:id].nil? ? super : super && matches_type(Constants::UIA_EDIT_CONTROL_TYPE)
end
|
#hwnd
37
38
39
|
# File 'lib/rautomation/adapter/win_ffi/text_field.rb', line 37
def hwnd
Functions.control_hwnd(@window.hwnd, @locators)
end
|
#set(text)
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/rautomation/adapter/win_ffi/text_field.rb', line 12
def set(text)
raise "Cannot set value on a disabled text field" if disabled?
wait_until do
hwnd = Functions.control_hwnd(@window.hwnd, @locators)
@window.activate
@window.active? &&
Functions.set_control_focus(hwnd) &&
Functions.set_control_text(hwnd, text) &&
value == text
end
end
|
#value
32
33
34
|
# File 'lib/rautomation/adapter/win_ffi/text_field.rb', line 32
def value
Functions.control_value(hwnd)
end
|