Class: Wrapybara::Button
- Inherits:
-
Object
show all
- Includes:
- Element
- Defined in:
- lib/wrapybara/elements/button.rb
Instance Method Summary
collapse
Methods included from Element
#default_how, #default_scope, #disabled?, #element, #element_identifier, #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, how = default_how) ⇒ Button
Returns a new instance of Button.
5
6
7
8
9
10
11
|
# File 'lib/wrapybara/elements/button.rb', line 5
def initialize(identifier, scope = default_scope, how = default_how)
@identifier = identifier
@how = how
@scope = scope
xpath = XPath::HTML.button(identifier)
@element = get_element(xpath, scope)
end
|
Instance Method Details
#click ⇒ Object
21
22
23
24
25
|
# File 'lib/wrapybara/elements/button.rb', line 21
def click
self.should_exist
@element.click
end
|
#should_exist ⇒ Object
13
14
15
|
# File 'lib/wrapybara/elements/button.rb', line 13
def should_exist
super "Expected a button #{self.element_identifier} to exist"
end
|
#should_not_exist ⇒ Object
17
18
19
|
# File 'lib/wrapybara/elements/button.rb', line 17
def should_not_exist
super "Did not expect a button #{self.element_identifier}' to exist"
end
|