1234567891011121314151617181920212223 |
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- const constants_1 = require("../constants");
- const utils_1 = require("../utils");
- async function findElementFromElements({ elementId, using, value }) {
- if (!constants_1.SUPPORTED_SELECTOR_STRATEGIES.includes(using)) {
- throw new Error(`selector strategy "${using}" is not yet supported`);
- }
- const elementHandle = await this.elementStore.get(elementId);
- if (!elementHandle) {
- throw utils_1.getStaleElementError(elementId);
- }
- if (using === 'link text') {
- using = 'xpath';
- value = `.//a[normalize-space() = "${value}"]`;
- }
- else if (using === 'partial link text') {
- using = 'xpath';
- value = `.//a[contains(., "${value}")]`;
- }
- return utils_1.findElements.call(this, elementHandle, using, value);
- }
- exports.default = findElementFromElements;
|