Module: WebDriverScriptAdapter::ScriptWriter

Defined in:
lib/webdriver_script_adapter/execute_async_script_adapter.rb

Class Method Summary collapse

Class Method Details

.async_results_identifierObject



48
49
50
51
# File 'lib/webdriver_script_adapter/execute_async_script_adapter.rb', line 48

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

.async_wrapper(script, *args) ⇒ Object



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

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

.callback(resultsIdentifier) ⇒ Object



53
54
55
# File 'lib/webdriver_script_adapter/execute_async_script_adapter.rb', line 53

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