Sha256: eafaabec6761e4f703c3252249d2f0ef4d5c38d7abb57fd463541f1360747013

Contents?: true

Size: 876 Bytes

Versions: 2

Compression:

Stored size: 876 Bytes

Contents

module Mohawk
  module Adapters
    module UIA
      class TextBox < Control
        valid_patterns :text, :value

        def enter(*args)
          send_keys *args
        end

        def set(value)
          if is_value?
            value_pattern.value = value
          else
            text_pattern.text = value
          end
        end

        def value
          return value_pattern.value if is_value?
          text_pattern.text
        end

        def clear
          set ''
        end

        private
        def is_value?
          element.patterns.include? :value
        end

        def value_pattern
          element.as :value
        end

        def is_text?
          element.patterns.include? :text
        end

        def text_pattern
          element.as :text
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mohawk-0.2.1 lib/mohawk/adapters/uia/text_box.rb
mohawk-0.2 lib/mohawk/adapters/uia/text_box.rb