class RAutomation::Adapter::Win32::TextField

Constants

DEFAULT_LOCATORS

Default locators used for searching text fields.

Public Instance Methods

clear() click to toggle source

@see RAutomation::TextField#clear

# File lib/rautomation/adapter/win_32/text_field.rb, line 26
def clear
  assert_enabled
  set ""
end
send_keys(*keys) click to toggle source

@see RAutomation::Window#send_keys

# 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) click to toggle source

@see RAutomation::TextField#set

# 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

Private Instance Methods

assert_enabled() click to toggle source
# File lib/rautomation/adapter/win_32/text_field.rb, line 46
def assert_enabled
  raise "Cannot set value on a disabled text field" if disabled?
end
set?(text) click to toggle source
# File lib/rautomation/adapter/win_32/text_field.rb, line 42
def set?(text)
  value == text
end