Class: AePageObjects::Element
- Inherits:
-
Node
- Object
- Node
- AePageObjects::Element
show all
- Defined in:
- lib/ae_page_objects/element.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
#node, #stale?
#node
Constructor Details
#initialize(parent, options_or_locator = {}) ⇒ Element
Returns a new instance of Element.
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/ae_page_objects/element.rb', line 13
def initialize(parent, options_or_locator = {})
@parent = parent
@locator = nil
@name = nil
configure(parse_options(options_or_locator))
raise ArgumentError, ":name or :locator is required" unless @name || @locator
@locator ||= default_locator
super(scoped_node)
end
|
Instance Attribute Details
#parent ⇒ Object
Returns the value of attribute parent.
3
4
5
|
# File 'lib/ae_page_objects/element.rb', line 3
def parent
@parent
end
|
Class Method Details
.new(*args) ⇒ Object
6
7
8
9
10
|
# File 'lib/ae_page_objects/element.rb', line 6
def new(*args)
super(*args).tap do |me|
yield me if block_given?
end
end
|
Instance Method Details
#__full_name__ ⇒ Object
39
40
41
42
43
44
45
|
# File 'lib/ae_page_objects/element.rb', line 39
def __full_name__
if parent.respond_to?(:__full_name__)
[ parent.__full_name__, __name__ ].compact.presence.try(:join, '_')
else
__name__
end
end
|
#__name__ ⇒ Object
51
52
53
|
# File 'lib/ae_page_objects/element.rb', line 51
def __name__
@name
end
|
#document ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/ae_page_objects/element.rb', line 27
def document
@document ||= begin
node = self.parent
until node.is_a?(::AePageObjects::Document)
node = node.parent
end
node
end
end
|
#full_name ⇒ Object
47
48
49
|
# File 'lib/ae_page_objects/element.rb', line 47
def full_name
__full_name__
end
|
#name ⇒ Object
55
56
57
|
# File 'lib/ae_page_objects/element.rb', line 55
def name
__name__
end
|
#to_s ⇒ Object
59
60
61
62
63
|
# File 'lib/ae_page_objects/element.rb', line 59
def to_s
super.tap do |str|
str << "@name:<#{@name}>; #@locator:<#{@locator}>"
end
end
|
#using_default_locator? ⇒ Boolean
65
66
67
|
# File 'lib/ae_page_objects/element.rb', line 65
def using_default_locator?
@locator == default_locator
end
|