Sha256: 02c7dc5038422577e58ba728d68fdfd6bdc19741940b39c6ee7f76ca3cf1859d
Contents?: true
Size: 964 Bytes
Versions: 17
Compression:
Stored size: 964 Bytes
Contents
# encoding: utf-8 module Watir module Container include XpathSupport def element(*args) HTMLElement.new(self, extract_selector(args)) end def elements(*args) HTMLElementCollection.new(self, extract_selector(args)) end 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 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
17 entries across 17 versions & 2 rubygems