Sha256: 78d3aa8450c0d14aa7ffa9e86e796c71d054de35d4378d83fa88bae06d333b98
Contents?: true
Size: 871 Bytes
Versions: 27
Compression:
Stored size: 871 Bytes
Contents
# encoding: utf-8 module Watir # # Represents an option in a select list. # class Option < HTMLElement # # Select this option # def select assert_exists @element.select fire_event("onclick") rescue nil end # # Toggle the selected state of this option # def toggle assert_exists @element.toggle end # # Is this option selected? # def selected? assert_exists @element.selected? end def text assert_exists # 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 @element.attribute(attribute) else @element.text end end end # Option end # Watir
Version data entries
27 entries across 27 versions & 2 rubygems