lib/kelp/attribute.rb
# Verify that the HTML element with the given ID exists, and is enabled (does
# not have the `disabled` attribute).
#
# @param [String] element_id
#   HTML `id` attribute of the element that should be enabled
#
# @raise [Kelp::Unexpected]
#   If the given element id is not found, or the element is not enabled
#
Verify that the HTML element with the given ID exists, and is enabled (does
not have the `disabled` attribute).
Verify that the HTML element with the given ID exists and is enabled ( does not have the ` disabled ` attribute ) .
def should_be_enabled(element_id)
      if page.has_xpath?("//*[@id='#{element_id}']")
        if page.has_xpath?("//*[@id='#{element_id}' and @disabled]")
          raise Kelp::Unexpected,
            "Expected element with id='#{element_id}' to be enabled," + \
            " but the 'disabled' attribute is present."
        end
      else
        raise Kelp::Unexpected,
          "Element with id='#{element_id}' not found."
      end
    end
def should_be_enabled ( element_id ) if page . has_xpath? ( "//*[@id='#{element_id}']" ) if page . has_xpath? ( "//*[@id='#{element_id}' and @disabled]" ) raise Kelp :: Unexpected , "Expected element with id='#{element_id}' to be enabled," + " but the 'disabled' attribute is present." end else raise Kelp :: Unexpected , "Element with id='#{element_id}' not found." end end
Verify that the HTML element with the given ID exists, and is enabled (does
not have the `disabled` attribute).
Verify that the HTML element with the given ID exists and is enabled ( does not have the ` disabled ` attribute ) .
[Kelp::Unexpected] If the given element id is not found, or the element is not enabled
[ Kelp :: Unexpected ] If the given element id is not found or the element is not enabled
element_id
<not_specific>
<not_specific>
element_id HTML `id` attribute of the element that should be enabled
element_id HTML ` id ` attribute of the element that should be enabled