Sha256: 753c581bf1edf78253a235b229e1d79c56ac10fa94989aef43d3e52033c206f8

Contents?: true

Size: 513 Bytes

Versions: 10

Compression:

Stored size: 513 Bytes

Contents

module Watir
  module JSSnippets
    #
    # @api private
    #

    def execute_js(function_name, *arguments)
      file = File.expand_path("../js_snippets/#{function_name}.js", __FILE__)
      raise Exception::Error, "Can not execute script as #{function_name}.js does not exist" unless File.exist?(file)

      js = File.read(file)
      script = "return (#{js}).apply(null, arguments)"
      @query_scope.execute_script(script, *arguments, function_name: function_name)
    end
  end # JSSnippets
end # Watir

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
watir-7.1.0 lib/watir/js_snippets.rb
watir-7.0.0 lib/watir/js_snippets.rb
watir-7.0.0.beta5 lib/watir/js_snippets.rb
watir-7.0.0.beta4 lib/watir/js_snippets.rb
watir-7.0.0.beta3 lib/watir/js_snippets.rb
watir-7.0.0.beta2 lib/watir/js_snippets.rb
watir-7.0.0.beta1 lib/watir/js_snippets.rb
watir-6.19.1 lib/watir/js_snippets.rb
watir-6.19.0 lib/watir/js_snippets.rb
watir-6.18.0 lib/watir/js_snippets.rb