Class: AutomationObject::State::ElementHash
- Includes:
- CommonElement
- Defined in:
- lib/automation_object/state/element_hash.rb
Overview
Element hash composite for managing state
Instance Attribute Summary
Attributes included from CommonElement
Attributes inherited from Base
Attributes inherited from Composite
#children, #location, #name, #parent
Instance Method Summary collapse
-
#utilize ⇒ Hash<String, AutomationObject::State::ElementProxy>
Selenium proxy.
Methods included from CommonElement
#active?, #method_hook?, #method_hooks, #method_to_container, #reset
Methods inherited from Base
#get_child, #get_children, #initialize, #screen, #top
Methods inherited from Composite
#add_has_many_relationships, #add_has_one_relationships, #get_child, #get_children, has_many, has_many_relationships, has_one, has_one_relationships, #initialize, #top
Methods included from Reflection
Methods included from CompositeHook
#after_create_run, #before_create_run, included
Constructor Details
This class inherits a constructor from AutomationObject::State::Base
Instance Method Details
#utilize ⇒ Hash<String, AutomationObject::State::ElementProxy>
Returns Selenium proxy
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/automation_object/state/element_hash.rb', line 15 def utilize return cache if cache elements = driver.find_elements(*blue_prints.selector_params) self.cache = {} elements.each do |element| # Want to wrap element, before sending for method! # That will help us include custom methods, etc... wrapped_element = ElementProxy.new(self, element) hash_key = wrapped_element.send(blue_prints.define_elements_by) # Send to wrapped state proxy cache[hash_key] = wrapped_element end @active = true cache end |