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. should be used over 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


582
583
584
585
# File 'lib/capybara/session.rb', line 582

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