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