Class: WebDriverScriptAdapter::ExecuteAsyncScriptAdapter

Inherits:
DumbDelegator
  • Object
show all
Defined in:
lib/webdriver_script_adapter/execute_async_script_adapter.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.wrap(driver) ⇒ Object



83
84
85
# File 'lib/webdriver_script_adapter/execute_async_script_adapter.rb', line 83

def self.wrap(driver)
  new driver
end

Instance Method Details

#execute_async_script(script, *args) ⇒ Object



87
88
89
90
91
# File 'lib/webdriver_script_adapter/execute_async_script_adapter.rb', line 87

def execute_async_script(script, *args)
  results = ScriptWriter.async_results_identifier
  execute_script ScriptWriter.async_wrapper(script, *args, ScriptWriter.callback(results))
  Patiently.wait_until { evaluate_script results }
end

#execute_async_script_fixed(script, *args) ⇒ Object



93
94
95
96
97
98
# File 'lib/webdriver_script_adapter/execute_async_script_adapter.rb', line 93

def execute_async_script_fixed(script, *args)
  page = __getobj__
  page = page.driver if page.respond_to?("driver")
  page = page.browser if page.respond_to?("browser") and not page.browser.is_a?(::Symbol)
  page.execute_async_script(script, *args)
end