UNPKG

playwright-fluent

Version:
21 lines (20 loc) 1.03 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.switchFromSelectorToIframe = void 0; const handle_actions_1 = require("../../handle-actions"); const get_handle_of_1 = require("../get-handle-of"); const utils_1 = require("../../../utils"); const dom_actions_1 = require("../../dom-actions"); async function switchFromSelectorToIframe(selector, pageProviderOrPageInstance, options) { const pageOrFrame = (0, dom_actions_1.getPageFrom)(pageProviderOrPageInstance); if (!pageOrFrame) { throw new Error(`Cannot switch to iframe from '${selector}' because no browser has been launched`); } const waitOptions = { ...utils_1.defaultWaitUntilOptions, ...options, }; const handle = await (0, get_handle_of_1.getHandleOf)(selector, pageProviderOrPageInstance, waitOptions); return (0, handle_actions_1.switchFromHandleToIframe)(handle, selector, pageProviderOrPageInstance, options); } exports.switchFromSelectorToIframe = switchFromSelectorToIframe;