webdriverio-automation
Version:
WebdriverIO-Automation android ios project
30 lines (24 loc) • 711 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = findElements;
var _constants = require("../constants");
var _utils = require("../utils");
async function findElements({
using,
value
}) {
if (!_constants.SUPPORTED_SELECTOR_STRATEGIES.includes(using)) {
throw new Error(`selector strategy "${using}" is not yet supported`);
}
if (using === 'link text') {
using = 'xpath';
value = `//a[normalize-space() = "${value}"]`;
} else if (using === 'partial link text') {
using = 'xpath';
value = `//a[contains(., "${value}")]`;
}
const page = this.getPageHandle(true);
return _utils.findElements.call(this, page, using, value);
}