class Mohawk::Adapters::UIA::Control

Attributes

patterns[R]

Public Class Methods

new(adapter, locator) click to toggle source
# File lib/mohawk/adapters/uia/control.rb, line 15
def initialize(adapter, locator)
  @parent = adapter.window.element
  @locator = locator
end
valid_patterns(*patterns) click to toggle source
# File lib/mohawk/adapters/uia/control.rb, line 10
def valid_patterns(*patterns)
  @patterns = patterns
end

Public Instance Methods

click() click to toggle source
# File lib/mohawk/adapters/uia/control.rb, line 20
def click
  element.click
end
control_name()
Alias for: value
disabled?() click to toggle source
# File lib/mohawk/adapters/uia/control.rb, line 37
def disabled?
  !enabled?
end
element() click to toggle source
# File lib/mohawk/adapters/uia/control.rb, line 45
def element
  @element ||= wait_until  { locate_element }
end
enabled?() click to toggle source
# File lib/mohawk/adapters/uia/control.rb, line 33
def enabled?
  exist? && element.enabled?
end
exist?() click to toggle source
# File lib/mohawk/adapters/uia/control.rb, line 28
def exist?
  locate_element != nil
end
Also aliased as: exists?
exists?()
Alias for: exist?
focus() click to toggle source
# File lib/mohawk/adapters/uia/control.rb, line 24
def focus
  element.focus
end
handle() click to toggle source
# File lib/mohawk/adapters/uia/control.rb, line 49
def handle
  element.handle
end
method_missing(meth, *args, &block) click to toggle source
Calls superclass method
# File lib/mohawk/adapters/uia/control.rb, line 62
def method_missing(meth, *args, &block)
  if element.respond_to? meth
    element.send meth, *args, &block
  else
    super
  end
end
value() click to toggle source
# File lib/mohawk/adapters/uia/control.rb, line 53
def value
  element.name
end
Also aliased as: control_name
view() click to toggle source
# File lib/mohawk/adapters/uia/control.rb, line 58
def view
  self
end
visible?() click to toggle source
# File lib/mohawk/adapters/uia/control.rb, line 41
def visible?
  exist? && element.visible?
end

Private Instance Methods

locate_element() click to toggle source
# File lib/mohawk/adapters/uia/control.rb, line 71
def locate_element
  scope = (@locator.delete(:children_only) && :children) || :descendants
  locator = @locator.merge(scope: scope)

  patterns = @locator.delete(:pattern) || self.class.patterns
  locator.merge!(pattern: patterns) if patterns

  @parent.find locator
end