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