Method: Capybara::Session#evaluate_script

Defined in:
lib/capybara/session.rb

#evaluate_script(script, *args) ⇒ Object

Evaluate the given JavaScript and return the result. Be careful when using this with scripts that return complex objects, such as jQuery statements. execute_script might be a better alternative.



577
578
579
580
581
# File 'lib/capybara/session.rb', line 577

def evaluate_script(script, *args)
  @touched = true
  result = driver.evaluate_script(script.strip, *driver_args(args))
  element_script_result(result)
end