Class: Wrapybara::Image
- Inherits:
-
Object
- Object
- Wrapybara::Image
- Includes:
- Element
- Defined in:
- lib/wrapybara/elements/image.rb
Instance Attribute Summary collapse
-
#element ⇒ Object
readonly
Returns the value of attribute element.
-
#how ⇒ Object
readonly
Returns the value of attribute how.
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
Instance Method Summary collapse
-
#initialize(identifier, scope = default_scope, how = default_how) ⇒ Image
constructor
A new instance of Image.
- #should_exist ⇒ Object
- #should_not_exist ⇒ Object
Methods included from Element
#click, #default_how, #default_scope, #disabled?, #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) ⇒ Image
Returns a new instance of Image.
7 8 9 10 11 12 13 |
# File 'lib/wrapybara/elements/image.rb', line 7 def initialize(identifier, scope = default_scope, how = default_how) @identifier = identifier @how = how @scope = scope xpath = "//img[@src='#{identifier}' or @id='#{identifier}' or @title='#{identifier}' or @alt='#{identifier}']" @element = get_element(xpath, scope) end |
Instance Attribute Details
#element ⇒ Object (readonly)
Returns the value of attribute element.
5 6 7 |
# File 'lib/wrapybara/elements/image.rb', line 5 def element @element end |
#how ⇒ Object (readonly)
Returns the value of attribute how.
5 6 7 |
# File 'lib/wrapybara/elements/image.rb', line 5 def how @how end |
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
5 6 7 |
# File 'lib/wrapybara/elements/image.rb', line 5 def identifier @identifier end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
5 6 7 |
# File 'lib/wrapybara/elements/image.rb', line 5 def scope @scope end |
Instance Method Details
#should_exist ⇒ Object
15 16 17 |
# File 'lib/wrapybara/elements/image.rb', line 15 def should_exist super "Expected an image #{self.element_identifier} to exist" end |
#should_not_exist ⇒ Object
19 20 21 |
# File 'lib/wrapybara/elements/image.rb', line 19 def should_not_exist super "Did not expect an image #{self.element_identifier}' to exist" end |