"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.locateByXpath = exports.locateByAlternateXPaths = void 0;
const elementUtil_1 = require("../elementUtil");
exports.locateByAlternateXPaths = {
    locate: async (driver, selector) => {
        if (!selector.alternateXPaths) {
            return new Set();
        }
        const allCandidates = [];
        for (const alternateXPath of selector.alternateXPaths) {
            const candidates = await driver.findElements('xpath', alternateXPath);
            allCandidates.push(...candidates);
        }
        return (0, elementUtil_1.uniqueElementReferenceSet)(allCandidates);
    },
    getPropertiesUsed() {
        return ['alternateXPaths'];
    },
};
exports.locateByXpath = {
    locate: async (driver, selector) => {
        if (!selector.xpath) {
            return new Set();
        }
        const candidates = await driver.findElements('xpath', selector.xpath);
        return (0, elementUtil_1.uniqueElementReferenceSet)(candidates);
    },
    getPropertiesUsed() {
        return ['xpath'];
    },
};
