Class: RAutomation::Adapter::Win32::TextField

Inherits:
Control
  • Object
show all
Includes:
WaitHelper
Defined in:
lib/rautomation/adapter/win_32/text_field.rb

Direct Known Subclasses

PasswordField

Constant Summary collapse

DEFAULT_LOCATORS =

Default locators used for searching text fields.

{:class => /edit/i}

Instance Method Summary collapse

Methods inherited from Control

#class_name, #click, #disabled?, #enabled?, #exist?, #focus, #focused?, #hwnd, #initialize, #value

Constructor Details

This class inherits a constructor from RAutomation::Adapter::Win32::Control

Instance Method Details

#clear

See Also:



26
27
28
29
# File 'lib/rautomation/adapter/win_32/text_field.rb', line 26

def clear
  assert_enabled
  set ""
end

#send_keys(*keys)

See Also:



32
33
34
35
36
37
38
# File 'lib/rautomation/adapter/win_32/text_field.rb', line 32

def send_keys(*keys)
  @window.container.wait_until_present
  assert_enabled
  @window.activate
  focus
  @window.send_keys(keys)
end

#set(text)

See Also:



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/rautomation/adapter/win_32/text_field.rb', line 12

def set(text)
  assert_enabled

  wait_until do
    hwnd = Functions.control_hwnd(@window.hwnd, @locators)
    @window.activate
    @window.active? &&
            focus &&
            Functions.set_control_text(hwnd, text) &&
            set?(text)
  end
end