Class: Wrapybara::Label
- Inherits:
-
Object
- Object
- Wrapybara::Label
- Includes:
- Element
- Defined in:
- lib/wrapybara/elements/label.rb
Instance Method Summary collapse
-
#initialize(identifier, scope = default_scope, how = default_how) ⇒ Label
constructor
A new instance of Label.
- #should_exist ⇒ Object
- #should_not_exist ⇒ Object
Methods included from Element
#click, #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) ⇒ Label
Returns a new instance of Label.
5 6 7 8 9 10 11 |
# File 'lib/wrapybara/elements/label.rb', line 5 def initialize(identifier, scope = default_scope, how = default_how) @identifier = identifier @how = how @scope = scope xpath = "//label[text()='#{identifier}' or @id='#{identifier}' or @for='#{identifier}']" @element = get_element(xpath, scope) end |
Instance Method Details
#should_exist ⇒ Object
13 14 15 |
# File 'lib/wrapybara/elements/label.rb', line 13 def should_exist super "Expected a label #{self.element_identifier} to exist" end |
#should_not_exist ⇒ Object
17 18 19 |
# File 'lib/wrapybara/elements/label.rb', line 17 def should_not_exist super "Did not expect a label #{self.element_identifier}' to exist" end |