"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ojSelectSingle = exports.OjSelectSingle = void 0;
const __1 = require("../../");
const OjSelectSingle_1 = require("./OjSelectSingle");
Object.defineProperty(exports, "OjSelectSingle", { enumerable: true, get: function () { return OjSelectSingle_1.OjSelectSingle; } });
/**
 * Retrieve an instance of [OjSelectSingle](../classes/elements.OjSelectSingle.html).
 * @example
 * ```javascript
 * import { ojSelectSingle } from '@oracle/oraclejet-webdriver/elements';
 * const el = await ojSelectSingle(driver, By.id('my-oj-select-single'));
 * ```
 * @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 ojSelectSingle(driver, by) {
    const webEl = await driver.findElement(by);
    // Check that the element is of type OjSelectSingle
    if (!(webEl instanceof OjSelectSingle_1.OjSelectSingle)) {
        const tagName = await webEl.getTagName();
        let supplemental = '';
        if (webEl.constructor.name === 'OjSelectSingle') {
            supplemental = 'You likely have multiple installations of this package.';
        }
        throw Error(`ojSelectSingle(${by}) created ${webEl.constructor.name} for <${tagName}>, but expected ${OjSelectSingle_1.OjSelectSingle.name}. ${supplemental}`);
    }
    return webEl;
}
exports.ojSelectSingle = ojSelectSingle;
(0, __1.register)('oj-select-single', OjSelectSingle_1.OjSelectSingle);
//# sourceMappingURL=index.js.map