Sha256: af07728e016928e715eaa102c02bf5d15b732ac33353f15539ce8f50fb56ba65

Contents?: true

Size: 920 Bytes

Versions: 12

Compression:

Stored size: 920 Bytes

Contents

# encoding: utf-8
module Watir
  class Radio < Input
    def self.from(parent, element)
      if element.attribute(:type) != "radio"
        raise TypeError, "expected type=radio for #{element.inspect}"
      end

      super
    end
    #
    # Select this radio button.
    #

    def set
      assert_exists
      assert_enabled

      @element.click unless set?
    end

    #
    # Is this radio set?
    #

    def set?
      assert_exists
      @element.selected?
    end
  end # Radio

  module Container
    def radio(*args)
      Radio.new(self, extract_selector(args).merge(:tag_name => "input", :type => "radio"))
    end

    def radios(*args)
      RadioCollection.new(self, extract_selector(args).merge(:tag_name => "input", :type => "radio" ))
    end
  end # Container

  class RadioCollection < InputCollection
    private

    def element_class
      Radio
    end
  end # RadioCollection
end # Watir

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
watir-webdriver-0.1.7 lib/watir-webdriver/elements/radio.rb
watir-webdriver-0.1.6 lib/watir-webdriver/elements/radio.rb
watir-webdriver-0.1.5 lib/watir-webdriver/elements/radio.rb
watir-webdriver-0.1.4 lib/watir-webdriver/elements/radio.rb
watir-webdriver-0.1.3 lib/watir-webdriver/elements/radio.rb
watir-webdriver-0.1.2 lib/watir-webdriver/elements/radio.rb
ayanko-watir-webdriver-0.1.1.1 lib/watir-webdriver/elements/radio.rb
watir-webdriver-0.1.1 lib/watir-webdriver/elements/radio.rb
watir-webdriver-0.1.0 lib/watir-webdriver/elements/radio.rb
watir-webdriver-0.0.9 lib/watir-webdriver/elements/radio.rb
watir-webdriver-0.0.8 lib/watir-webdriver/elements/radio.rb
watir-webdriver-0.0.7 lib/watir-webdriver/elements/radio.rb