Sha256: c99af70ea8380fefe38d02a9892f17aba582b9fdcae0b4c6fead3fc20e156c4a

Contents?: true

Size: 647 Bytes

Versions: 24

Compression:

Stored size: 647 Bytes

Contents

# encoding: utf-8
module Watir
  module Container
    include XpathSupport
    include Atoms

    def element(*args)
      HTMLElement.new(self, extract_selector(args))
    end

    def elements(*args)
      HTMLElementCollection.new(self, extract_selector(args))
    end

    def extract_selector(selectors)
      case selectors.size
      when 2
        return { selectors[0] => selectors[1] }
      when 1
        obj = selectors.first
        return obj if obj.kind_of? Hash
      when 0
        return {}
      end

      raise ArgumentError, "expected Hash or (:how, 'what'), got #{selectors.inspect}"
    end

  end # Container
end # Watir

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
watir-webdriver-0.3.2 lib/watir-webdriver/container.rb
watir-webdriver-0.3.1 lib/watir-webdriver/container.rb
watir-webdriver-0.3.0 lib/watir-webdriver/container.rb
watir-webdriver-0.2.9 lib/watir-webdriver/container.rb