Sha256: e1760189ea2657b7532d2ba76e88f633b0aab4f9ad751f47839a233442b6cc46

Contents?: true

Size: 820 Bytes

Versions: 2

Compression:

Stored size: 820 Bytes

Contents

module Uia
  class Element
    def initialize(element)
      @element = element
      @default = lambda { [:unknown] }
    end

    def control_type
      Library::Constants::ControlTypes.find(@default) { |_, v| v == control_type_id }.first
    end

    def patterns
      pattern_ids.map do |id|
        Library::Constants::Patterns.find(@default) { |_, v| v == id }.first
      end
    end

    def children
      @element.children.map { |c| Element.new c }
    end

    def descendants
      @element.descendants.map { |c| Element.new c }
    end

    def click
      Library.click(@element)
      true
    end

    def method_missing(meth, *args, &block)
      if @element.respond_to? meth
        return @element.send(meth, *args, &block)
      end
      super
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
uia-0.0.5.1 lib/uia/element.rb
uia-0.0.5 lib/uia/element.rb