"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ojSelectOne = exports.OjSelectOne = void 0;
const __1 = require("../../");
const OjSelectOne_1 = require("./OjSelectOne");
Object.defineProperty(exports, "OjSelectOne", { enumerable: true, get: function () { return OjSelectOne_1.OjSelectOne; } });
/**
 * Retrieve an instance of [OjSelectOne](../classes/elements.OjSelectOne.html).
 * @example
 * ```javascript
 * import { ojSelectOne } from '@oracle/oraclejet-webdriver/elements';
 * const el = await ojSelectOne(driver, By.id('my-oj-select-one'));
 * ```
 * @param driver A WebDriver/WebElement instance from where the element will be
 * searched. If WebDriver is passed, the element will be searched globally in the
 * document. If WebElement is passed, the search will be relative to this element.
 * @param by The locator with which to find the element
 */
async function ojSelectOne(driver, by) {
    const webEl = await driver.findElement(by);
    // Check that the element is of type OjSelectOne
    if (!(webEl instanceof OjSelectOne_1.OjSelectOne)) {
        const tagName = await webEl.getTagName();
        let supplemental = '';
        if (webEl.constructor.name === 'OjSelectOne') {
            supplemental = 'You likely have multiple installations of this package.';
        }
        throw Error(`ojSelectOne(${by}) created ${webEl.constructor.name} for <${tagName}>, but expected ${OjSelectOne_1.OjSelectOne.name}. ${supplemental}`);
    }
    return webEl;
}
exports.ojSelectOne = ojSelectOne;
(0, __1.register)('oj-select-one', OjSelectOne_1.OjSelectOne);
//# sourceMappingURL=index.js.map