Class: BaseElement

Inherits:
Object
  • Object
show all
Defined in:
lib/rutl/interface/elements/base_element.rb

Overview

Page elements. Base class.

Direct Known Subclasses

Button, Checkbox, Link, Text

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(element_context) ⇒ BaseElement

Returns a new instance of BaseElement.



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/rutl/interface/elements/base_element.rb', line 7

def initialize(element_context)
  raise element_context.to_s unless element_context.is_a? ElementContext
  @context = element_context
  # Not sure why, but I'm seeing Chrome fail becase the context interface
  # passed in isn't the same as the browser's interface.
  # This only happens with click test cases, before the click, and
  # only if that case isn't run first.
  # The context we're passed is also an instance from as ChromeInterface,
  # but a different instance.
  #
  # Here's the kludge workaround line:
  @context.interface = $browser.interface
end

Instance Attribute Details

#contextObject

Returns the value of attribute context.



5
6
7
# File 'lib/rutl/interface/elements/base_element.rb', line 5

def context
  @context
end

Instance Method Details

#this_cssObject



21
22
23
# File 'lib/rutl/interface/elements/base_element.rb', line 21

def this_css
  @context.find_element(:css)
end