Method: Capybara::Session#execute_script

Defined in:
lib/capybara/session.rb

#execute_script(script, *args) ⇒ Object

Execute the given script, not returning a result. This is useful for scripts that return complex objects, such as jQuery statements. #execute_script should be used over #evaluate_script whenever possible.

Parameters:

  • script (String)

    A string of JavaScript to execute

  • args

    Optional arguments that will be passed to the script. Driver support for this is optional and types of objects supported may differ between drivers


580
581
582
583
# File 'lib/capybara/session.rb', line 580

def execute_script(script, *args)
  @touched = true
  driver.execute_script(script, *driver_args(args))
end