UNPKG

webdriverio

Version:

Next-gen browser and mobile automation test framework for Node.js

33 lines (23 loc) 793 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _getElementObject = require("../../utils/getElementObject"); var _constants = require("../../constants"); async function custom$(strategyName, strategyArguments) { const strategy = this.strategies.get(strategyName); if (!strategy) { throw Error('No strategy found for ' + strategyName); } let res = await this.execute(strategy, strategyArguments); if (Array.isArray(res)) { res = res[0]; } if (res && typeof res[_constants.ELEMENT_KEY] === 'string') { return await _getElementObject.getElement.call(this, strategy, res); } throw Error('Your locator strategy script must return an element'); } var _default = custom$; exports.default = _default;