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