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