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