module AutomationObject::BluePrint::PageObjectAdapter::ElementHelper

Helper module for Element composite classes

Public Instance Methods

default_input() click to toggle source

@return [String, nil] text input for automatic screen/modal change if needed

# File lib/automation_object/blue_print/page_object_adapter/helpers/element_helper.rb, line 11
def default_input
  get_property(:default_input)
end
in_iframe() click to toggle source

@return [Symbol, nil] element name of iframe element is in or nil if not

# File lib/automation_object/blue_print/page_object_adapter/helpers/element_helper.rb, line 25
def in_iframe
  case hash[:in_iframe]
  when Symbol, String
    hash[:in_iframe].to_sym
  end
end
in_iframe?() click to toggle source

@return [Boolean] whether or not element is in iframe

# File lib/automation_object/blue_print/page_object_adapter/helpers/element_helper.rb, line 33
def in_iframe?
  in_iframe ? true : false
end
method_hook?(name) click to toggle source
# File lib/automation_object/blue_print/page_object_adapter/helpers/element_helper.rb, line 37
def method_hook?(name)
  method_hooks.key?(name)
end
method_hooks() click to toggle source

@return [Hash<Hook>] hash of Hook that are defined under the element

# File lib/automation_object/blue_print/page_object_adapter/helpers/element_helper.rb, line 42
def method_hooks
  return @method_hooks if defined? @method_hooks

  children = {}
  hash.each do |key, value|
    # Skip possible keys that elements can have
    # Otherwise should be a method hook
    next if %i[load custom_methods in_iframe css xpath define_elements_by custom_range].include?(key)
    children[key] = value
  end

  @method_hooks = create_hash_children(children,
                                       interface: Hook,
                                       location: location + '[hook]')

  @method_hooks
end
selector_params() click to toggle source

@return [Array<Symbol, String>, nil] params as an array for driver find_element args

# File lib/automation_object/blue_print/page_object_adapter/helpers/element_helper.rb, line 16
def selector_params
  if hash[:xpath].is_a?(String)
    [:xpath, hash[:xpath]]
  elsif hash[:css].is_a?(String)
    [:css, hash[:css]]
  end
end