Class: AutomationObject::Driver::Element

Inherits:
Base
  • Object
show all
Defined in:
lib/automation_object/driver/element.rb

Overview

Element adapter interface

Instance Attribute Summary

Attributes inherited from Base

#adapter

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from AutomationObject::Driver::Base

Instance Method Details

#attribute(key, value = nil) ⇒ String?

Set or Get attribute

Parameters:

  • key (String)

    key of element

  • value (String, nil) (defaults to: nil)

    set value or leave blank

Returns:



13
14
15
# File 'lib/automation_object/driver/element.rb', line 13

def attribute(key, value = nil)
  adapter.attribute(key, value)
end

#box_coordinatesBoxCoordinates

Returns :x1, :x2, :y1, :y2 coordinates of a box

Returns:



116
117
118
# File 'lib/automation_object/driver/element.rb', line 116

def box_coordinates
  adapter.box_coordinates
end

#clearvoid

This method returns an undefined value.

Clear the element field



41
42
43
# File 'lib/automation_object/driver/element.rb', line 41

def clear
  adapter.clear
end

#clickvoid

This method returns an undefined value.

Perform a click action on the element



81
82
83
# File 'lib/automation_object/driver/element.rb', line 81

def click
  adapter.click
end

#collides_with_element?(second_element_object, collision_tolerance = false) ⇒ Boolean

Returns element collides with other

Parameters:

  • second_element_object (Object)

    element to compare to

  • collision_tolerance (Numeric, FalseClass) (defaults to: false)

    pixel tolerance of collisions

Returns:

  • (Boolean)

    element collides with other



123
124
125
# File 'lib/automation_object/driver/element.rb', line 123

def collides_with_element?(second_element_object, collision_tolerance = false)
  adapter.collides_with_element?(second_element_object, collision_tolerance)
end

#contentString?

Returns content attribute

Returns:

  • (String, nil)

    content attribute



106
107
108
# File 'lib/automation_object/driver/element.rb', line 106

def content
  adapter.content
end

#element_centerPoint

Returns :x, :y coordinates

Returns:

  • (Point)

    :x, :y coordinates



111
112
113
# File 'lib/automation_object/driver/element.rb', line 111

def element_center
  adapter.element_center
end

#heightNumeric

Returns height of element

Returns:

  • (Numeric)

    height of element



101
102
103
# File 'lib/automation_object/driver/element.rb', line 101

def height
  adapter.height
end

#hovervoid

This method returns an undefined value.

Hover over element



129
130
131
# File 'lib/automation_object/driver/element.rb', line 129

def hover
  adapter.hover
end

#hrefString

Returns href of element

Returns:

  • (String)

    href of element



23
24
25
# File 'lib/automation_object/driver/element.rb', line 23

def href
  adapter.href
end

#idString

Returns id of element

Returns:



18
19
20
# File 'lib/automation_object/driver/element.rb', line 18

def id
  adapter.id
end

#invisible?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/automation_object/driver/element.rb', line 51

def invisible?
  adapter.invisible?
end

#locationPoint

Get the location

Returns:



57
58
59
# File 'lib/automation_object/driver/element.rb', line 57

def location
  adapter.location
end

#scroll_into_viewvoid

This method returns an undefined value.

Scroll the element into view



75
76
77
# File 'lib/automation_object/driver/element.rb', line 75

def scroll_into_view
  adapter.scroll_into_view
end

#send_keys(string) ⇒ void

This method returns an undefined value.

Type into an element



35
36
37
# File 'lib/automation_object/driver/element.rb', line 35

def send_keys(string)
  adapter.send_keys(string)
end

#sizeDimension

Get the size of an element

Returns:



63
64
65
# File 'lib/automation_object/driver/element.rb', line 63

def size
  adapter.size
end

#submitvoid

This method returns an undefined value.

Perform a submit action on an element



69
70
71
# File 'lib/automation_object/driver/element.rb', line 69

def submit
  adapter.submit
end

#switch_to_iframevoid

This method returns an undefined value.

Helper method to switch to this element's iframe



135
136
137
# File 'lib/automation_object/driver/element.rb', line 135

def switch_to_iframe
  adapter.switch_to_iframe
end

#textString?

Text of element

Returns:



29
30
31
# File 'lib/automation_object/driver/element.rb', line 29

def text
  adapter.text
end

#visible?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/automation_object/driver/element.rb', line 46

def visible?
  adapter.visible?
end

#widthNumeric

Returns width of element

Returns:

  • (Numeric)

    width of element



96
97
98
# File 'lib/automation_object/driver/element.rb', line 96

def width
  adapter.width
end

#xNumeric

Returns x position of element

Returns:

  • (Numeric)

    x position of element



86
87
88
# File 'lib/automation_object/driver/element.rb', line 86

def x
  adapter.x
end

#yNumeric

Returns y position of element

Returns:

  • (Numeric)

    y position of element



91
92
93
# File 'lib/automation_object/driver/element.rb', line 91

def y
  adapter.y
end