Module: Watir::JSSnippets
- Included in:
- Container, ElementCollection, Locators::Element::Matcher
- Defined in:
- lib/watir/js_snippets.rb
Instance Method Summary collapse
Instance Method Details
#execute_js(function_name, *arguments) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
9 10 11 12 13 14 15 16 |
# File 'lib/watir/js_snippets.rb', line 9 def execute_js(function_name, *arguments) file = File.("../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 |