class RAutomation::TextField

Public Instance Methods

clear() click to toggle source

Clears text field's text. @raise [UnknownTextFieldException] if the text field doesn't exist.

# File lib/rautomation/text_field.rb, line 21
def clear
  wait_until_exists
  @text_field.clear
end
exist?()
Alias for: exists?
exists?() click to toggle source

Checks if the text field exists. @return [Boolean] true if text field exists, false otherwise.

# File lib/rautomation/text_field.rb, line 36
def exists?
  @text_field.exists?
end
Also aliased as: exist?
hwnd() click to toggle source
# File lib/rautomation/text_field.rb, line 40
def hwnd
  wait_until_exists
  @text_field.hwnd
end
method_missing(name, *args) click to toggle source

Allows to execute specific {Adapter} methods not part of the public API.

# File lib/rautomation/text_field.rb, line 48
def method_missing(name, *args)
  @text_field.send(name, *args)
end
set(text) click to toggle source

Sets text of the text field. @param [String] text of the field to set. @raise [UnknownTextFieldException] if the text field doesn't exist.

# File lib/rautomation/text_field.rb, line 14
def set(text)
  wait_until_exists
  @text_field.set(text)
end
value() click to toggle source

Returns text field's current value (text). @return [String] the value (text) of the text field. @raise [UnknownTextFieldException] if the text field doesn't exist.

# File lib/rautomation/text_field.rb, line 29
def value
  wait_until_exists
  @text_field.value
end

Private Instance Methods

wait_until_exists() click to toggle source
# File lib/rautomation/text_field.rb, line 54
def wait_until_exists
  WaitHelper.wait_until {exists?}
rescue WaitHelper::TimeoutError
  raise UnknownTextFieldException, "Text field #{@locators.inspect} doesn't exist on window #{@window.locators.inspect}!" unless exists?
end