Class: Wrapybara::Content
- Inherits:
-
Object
- Object
- Wrapybara::Content
show all
- Includes:
- Element
- Defined in:
- lib/wrapybara/elements/content.rb
Instance Method Summary
collapse
Methods included from Element
#default_how, #default_scope, #disabled?, #element, #enabled?, #exists?, #focused?, #get_element, #parent_identifier, #path, #should_be_disabled, #should_be_enabled, #should_be_focused, #should_be_visible, #should_have_attribute, #should_not_be_disabled, #should_not_be_enabled, #should_not_be_focused, #should_not_be_visible, #should_not_have_attribute, #style, #visible?, #within
Constructor Details
#initialize(identifier, scope = default_scope) ⇒ Content
Returns a new instance of Content.
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/wrapybara/elements/content.rb', line 5
def initialize(identifier, scope = default_scope)
@identifier = identifier
@scope = scope
xpath = %{//*[contains(text(), "#{identifier}")]}
@element = get_element(xpath, scope)
end
|
Instance Method Details
#click ⇒ Object
16
17
18
19
|
# File 'lib/wrapybara/elements/content.rb', line 16
def click
self.should_be_visible
super
end
|
#element_identifier ⇒ Object
29
30
31
|
# File 'lib/wrapybara/elements/content.rb', line 29
def element_identifier
"'#{@identifier}'#{self.within(@scope)}"
end
|
#should_exist ⇒ Object
21
22
23
|
# File 'lib/wrapybara/elements/content.rb', line 21
def should_exist
super "Expected content #{self.element_identifier} to exist"
end
|
#should_not_exist ⇒ Object
25
26
27
|
# File 'lib/wrapybara/elements/content.rb', line 25
def should_not_exist
super "Did not expect content #{self.element_identifier} to exist"
end
|