Sha256: 9737048b06a2faf7e894e96ace01d74abf3bdd18f10ace36a6473dcc695baffe

Contents?: true

Size: 818 Bytes

Versions: 1

Compression:

Stored size: 818 Bytes

Contents

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

    private

    def browserbot(function_name, *arguments)
      script = browserbot_script + "return browserbot.#{function_name}.apply(browserbot, arguments);"
      driver.execute_script(script, *arguments)
    end

    def browserbot_script
      @browserbot_script ||= File.read("#{File.dirname(__FILE__)}/browserbot.js")
    end

    def extract_selector(selectors)
      case selectors.size
      when 2
        { selectors[0] => selectors[1] }
      when 1
        unless selectors.first.kind_of? Hash
          raise ArgumentError, "expected Hash or (:how, 'what')"
        end

        selectors.first
      when 0
        {}
      else
        raise ArgumentError, selectors.inspect
      end
    end

  end # Container
end # Watir

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
watir-webdriver-0.0.7 lib/watir-webdriver/container.rb