webdriverio
Version:
Next-gen browser and mobile automation test framework for Node.js
33 lines (23 loc) • 906 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _utils = require("../../utils");
var _getElementObject = require("../../utils/getElementObject");
var _constants = require("../../constants");
async function custom$$(strategyName, strategyArgument) {
const strategy = this.strategies.get(strategyName);
if (!strategy) {
throw Error('No strategy found for ' + strategyName);
}
let res = await this.execute(strategy, strategyArgument);
if (!Array.isArray(res)) {
res = [res];
}
res = res.filter(el => !!el && typeof el[_constants.ELEMENT_KEY] === 'string');
const elements = res.length ? await _getElementObject.getElements.call(this, strategy, res) : [];
return (0, _utils.enhanceElementsArray)(elements, this, strategyName, 'custom$$', [strategyArgument]);
}
var _default = custom$$;
exports.default = _default;