"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const constants_1 = require("../constants"); const utils_1 = require("../utils"); async function findElementFromElement({ 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.findElement.call(this, elementHandle, using, value); } exports.default = findElementFromElement;