Sha256: f3685fb3d4d5eb915078a417fc638fd3fe3a1f9a29635acc24a82b2220f8a8c7
Contents?: true
Size: 1.71 KB
Versions: 3
Compression:
Stored size: 1.71 KB
Contents
# encoding: utf-8 module Watir class Input < HTMLElement alias_method :readonly?, :read_only? # # @private # # subclasses can use this to validate the incoming element # def self.from(parent, element) unless element.tag_name == "input" raise TypeError, "can't create #{self} from #{element.inspect}" end new(parent, :element => element) end def enabled? !disabled? end # # Return the type attribute of the element, or 'text' if the attribute is invalid. # TODO: discuss. # # @return [String] # def type assert_exists value = @element.attribute("type").to_s # we return 'text' if the type is invalid # not sure if we really should do this TextFieldLocator::NON_TEXT_TYPES.include?(value) ? value : 'text' end # # not sure about this # # this is mostly useful if you're using Browser#element_by_xpath, and want to # 'cast' the returned Input instance to one of the subclasses # # # @return [Watir::CheckBox] # def to_checkbox assert_exists CheckBox.from(@parent, @element) end # # @return [Watir::Radio] # def to_radio assert_exists Radio.from(@parent, @element) end # # @return [Watir::Button] # def to_button assert_exists Button.from(@parent, @element) end # # @return [Watir::TextField] # def to_text_field assert_exists TextField.from(@parent, @element) end # # @return [Watir::FileField] # def to_file_field assert_exists FileField.from(@parent, @element) end end # Input end # Watir
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
watir-webdriver-0.0.9 | lib/watir-webdriver/elements/input.rb |
watir-webdriver-0.0.8 | lib/watir-webdriver/elements/input.rb |
watir-webdriver-0.0.7 | lib/watir-webdriver/elements/input.rb |