Sha256: 8d6f3f3bff3e665da164ca5194f04b7a7e548ddacd745ed8e8c99c905555eabe

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 KB

Contents

module RAutomation
  module Adapter
    module Win32
      class TextField < Control
        include WaitHelper
        include Locators

        # Default locators used for searching text fields.
        DEFAULT_LOCATORS = {:class => /edit/i}

        # @see RAutomation::TextField#set
        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? &&
                    focus &&
                    Functions.set_control_text(hwnd, text) &&
                    value == text
          end
        end

        # @see RAutomation::TextField#clear
        def clear
          raise "Cannot set value on a disabled text field" if disabled?
          set ""
        end

        # @see RAutomation::Window#send_keys
        def send_keys(*keys)
          @window.container.wait_until_present
          assert_enabled
          @window.activate
          focus
          @window.send_keys(keys)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rautomation-0.7.2 lib/rautomation/adapter/win_32/text_field.rb
rautomation-0.7.1 lib/rautomation/adapter/win_32/text_field.rb
rautomation-0.7.0 lib/rautomation/adapter/win_32/text_field.rb