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