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