Method: Capybara::Session#evaluate_async_script

Defined in:
lib/capybara/session.rb

#evaluate_async_script(script, *args) ⇒ Object

Evaluate the given JavaScript and obtain the result from a callback function which will be passed as the last argument to the script.

Parameters:

  • script (String)

    A string of JavaScript to evaluate

  • args

    Optional arguments that will be passed to the script

Returns:

  • (Object)

    The result of the evaluated JavaScript (may be driver specific)



633
634
635
636
637
# File 'lib/capybara/session.rb', line 633

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