webdriverjs
Version:
A nodejs bindings implementation for selenium 2.0/webdriver
24 lines (17 loc) • 480 B
JavaScript
module.exports = function executeAsync (script, args, callback) {
if (typeof args === 'function') {
callback = args;
args = [];
}
if(!(args instanceof Array)) {
args = [args];
}
if (typeof script === 'function') {
script = 'return (' + script + ').apply(null, arguments);';
}
this.requestHandler.create(
"/session/:sessionId/execute_async",
{script: script, args: args},
callback
);
};