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