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