Sha256: b853fee59e1ecd39788d3213949785ef977e2e9a782a56cb378cc6d9ec1061e8

Contents?: true

Size: 466 Bytes

Versions: 3

Compression:

Stored size: 466 Bytes

Contents

# encoding: utf-8
module Watir
  class CheckBox < Input
    identifier :type => 'checkbox'

    container_method  :checkbox
    collection_method :checkboxes

    def set(bool = true)
      assert_exists
      assert_enabled

      if @element.selected?
        @element.click unless bool
      else
        @element.click if bool
      end
    end

    def set?
      assert_exists
      @element.selected?
    end

    def clear
      set false
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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