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