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.


597
598
599
600
601
# File 'lib/capybara/session.rb', line 597

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