Sha256: 92feac83eaf2b0a9df1f6bebb5b0cf970dc946db6d802a7f61bfefb55b9db43f

Contents?: true

Size: 644 Bytes

Versions: 4

Compression:

Stored size: 644 Bytes

Contents

# encoding: utf-8
module Watir
  class Option < HTMLElement

    def select
      assert_exists
      @element.select
    end
    
    def toggle
      assert_exists
      @element.toggle
    end
    
    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

4 entries across 4 versions & 1 rubygems

Version Path
watir-webdriver-0.0.1.dev4 lib/watir-webdriver/elements/option.rb
watir-webdriver-0.0.1.dev3 lib/watir-webdriver/elements/option.rb
watir-webdriver-0.0.1.dev2 lib/watir-webdriver/elements/option.rb
watir-webdriver-0.0.1.dev lib/watir-webdriver/elements/option.rb