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(selectors = {}, destinations = []) ⇒ BaseElement

Returns a new instance of BaseElement.



12
13
14
15
# File 'lib/rutl/interface/elements/base_element.rb', line 12

def initialize(selectors = {}, destinations = [])
  @selectors = selectors
  @destinations = destinations
end

Instance Attribute Details

#destinationsObject

Returns the value of attribute destinations.



10
11
12
# File 'lib/rutl/interface/elements/base_element.rb', line 10

def destinations
  @destinations
end

#interfaceObject

Returns the value of attribute interface.



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

def interface
  @interface
end

#selectorsObject

Returns the value of attribute selectors.



9
10
11
# File 'lib/rutl/interface/elements/base_element.rb', line 9

def selectors
  @selectors
end

Instance Method Details

#driverObject



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

def driver
  @interface.driver
end

#find_css(selectors) ⇒ Object



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

def find_css(selectors)
  result = driver.find_element(:css, selectors[:css])
  return result unless NullDriver == result.class
  result.destinations = @destinations
  result.interface = @interface
  result
end

#this_cssObject



25
26
27
# File 'lib/rutl/interface/elements/base_element.rb', line 25

def this_css
  find_css(@selectors)
end