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