Module: WebDriverScriptAdapter::ScriptWriter

Defined in:
lib/webdriver_script_adapter/execute_async_script_adapter.rb

Class Method Summary collapse

Class Method Details

.async_results_identifierObject



57
58
59
60
# File 'lib/webdriver_script_adapter/execute_async_script_adapter.rb', line 57

def async_results_identifier
  id = WebDriverScriptAdapter.async_results_identifier
  "window['#{id.respond_to?(:call) ? id.call : id}']"
end

.async_wrapper(script, *args) ⇒ Object



66
67
68
# File 'lib/webdriver_script_adapter/execute_async_script_adapter.rb', line 66

def async_wrapper(script, *args)
  "(function(){ #{script} })(#{args.join(", ")});"
end

.callback(resultsIdentifier) ⇒ Object



62
63
64
# File 'lib/webdriver_script_adapter/execute_async_script_adapter.rb', line 62

def callback(resultsIdentifier)
  "function(err, returnValue){ #{resultsIdentifier} = (err || returnValue); }"
end