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