Sha256: a7bb67a0899d723bcb4d3cc75c28318f2caf8cfce5d78823fe3f0185c1be6b46
Contents?: true
Size: 1.23 KB
Versions: 5
Compression:
Stored size: 1.23 KB
Contents
# encoding: utf-8 module Watir # # Class representing button elements. # # This class covers both <button> and <input type="submit|reset|image|button" /> elements. # class Button < HTMLElement # add the attributes from <input> attributes Watir::Input.typed_attributes VALID_TYPES = %w[button reset submit image] # # Returns the text of the button. # # For input elements, returns the "value" attribute. # For button elements, returns the inner text. # def text assert_exists case @element.tag_name when 'input' @element.attribute(:value) when 'button' @element.text else raise Exception::Error, "unknown tag name for button: #{@element.tag_name}" end end # # Returns true if this element is enabled # # @return [Boolean] # def enabled? !disabled? end private def locate @parent.assert_exists ButtonLocator.new(@parent.wd, @selector, self.class.attribute_list).locate end end # Button class ButtonCollection < ElementCollection private def locator_class ButtonLocator end def element_class Button end end # ButtonsCollection end # Watir
Version data entries
5 entries across 5 versions & 1 rubygems