Class: ElementContext
- Inherits:
-
Object
- Object
- ElementContext
- Defined in:
- lib/rutl/interface/elements/element_context.rb
Overview
The context passed around to all elements. What they need to know outside of themselves to function.
Instance Attribute Summary collapse
-
#destinations ⇒ Object
Returns the value of attribute destinations.
-
#interface ⇒ Object
Returns the value of attribute interface.
-
#selectors ⇒ Object
Returns the value of attribute selectors.
Instance Method Summary collapse
- #find_element(type) ⇒ Object
-
#initialize(destinations: nil, interface: nil, selectors: []) ⇒ ElementContext
constructor
A new instance of ElementContext.
Constructor Details
#initialize(destinations: nil, interface: nil, selectors: []) ⇒ ElementContext
Returns a new instance of ElementContext.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/rutl/interface/elements/element_context.rb', line 10 def initialize(destinations: nil, interface: nil, selectors: []) unless destinations.nil? || destinations.class == Array # Should check each destination to make sure it's a Page or a _____, too. raise 'destination must be an Array of destinations or nil.' end @destinations = destinations || [] unless interface.nil? || interface.class.ancestors.include?(BaseInterface) raise "#{interface.class}: #{interface} must be a *Interface class." end @interface = interface @selectors = selectors end |
Instance Attribute Details
#destinations ⇒ Object
Returns the value of attribute destinations.
6 7 8 |
# File 'lib/rutl/interface/elements/element_context.rb', line 6 def destinations @destinations end |
#interface ⇒ Object
Returns the value of attribute interface.
7 8 9 |
# File 'lib/rutl/interface/elements/element_context.rb', line 7 def interface @interface end |
#selectors ⇒ Object
Returns the value of attribute selectors.
8 9 10 |
# File 'lib/rutl/interface/elements/element_context.rb', line 8 def selectors @selectors end |
Instance Method Details
#find_element(type) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/rutl/interface/elements/element_context.rb', line 23 def find_element(type) # @interface.driver.find_element(type, @selectors[type]) # Should be this, but apparently @interface.driver is being overwritten # (or not written to) and it doesn't work. Using $browser does. :-( $browser.interface.driver.find_element(type, @selectors[type]) end |