Sha256: 968f39f69dc72536a8a7f93c35021687eaa359b2ecf707527df9a8dc2f3d32aa
Contents?: true
Size: 1.33 KB
Versions: 1
Compression:
Stored size: 1.33 KB
Contents
# encoding: utf-8 module Watir # # Represents an option in a select list. # class Option < HTMLElement # # Selects this option. # # @example # browser.select(:id => "foo").options.first.select # alias_method :select, :click # # Toggles the selected state of this option. # # @example # browser.select(:id => "foo").options.first.toggle # alias_method :toggle, :click # # Clears (i.e. toggles selected state) option. # # @example # browser.select(:id => "foo").options.first.clear # def clear click if selected? end # # Is this option selected? # # @return [Boolean] # def selected? assert_exists element_call { @element.selected? } end # # Returns the text of option. # # Note that the text is either one of the following respectively: # * label attribute # * text attribute # * inner element text # # @return [String] # def text # A little unintuitive - we'll return the 'label' or 'text' attribute if # they exist, otherwise the inner text of the element attribute = [:label, :text].find { |a| attribute? a } if attribute attribute_value(attribute) else super end end end # Option end # Watir
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
watir-webdriver-0.7.0 | lib/watir-webdriver/elements/option.rb |