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