webdriverio
Version:
Next-gen browser and mobile automation test framework for Node.js
22 lines (16 loc) • 558 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = execute;
var _utils = require("../../utils");
function execute(...args) {
let script = args.shift();
if (typeof script !== 'string' && typeof script !== 'function') {
throw new Error('number or type of arguments don\'t agree with execute protocol command');
}
if (typeof script === 'function') {
script = `return (${script}).apply(null, arguments)`;
}
return this.executeScript(script, (0, _utils.verifyArgsAndStripIfElement)(args));
}