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



603
604
605
606
# File 'lib/capybara/session.rb', line 603

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