Sha256: 976a6ba8609b3f0db24a266b35f2518f7facf2d9ba424f42ef8f44aaa3ea63c1

Contents?: true

Size: 544 Bytes

Versions: 4

Compression:

Stored size: 544 Bytes

Contents

# frozen_string_literal: true

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

4 entries across 4 versions & 1 rubygems

Version Path
watir-7.3.0 lib/watir/js_snippets.rb
watir-7.2.2 lib/watir/js_snippets.rb
watir-7.2.1 lib/watir/js_snippets.rb
watir-7.2.0 lib/watir/js_snippets.rb