UNPKG

playwright-fluent

Version:
16 lines (15 loc) 895 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isSelectorObjectVisible = void 0; const utils_1 = require("../../../utils"); const handle_actions_1 = require("../../handle-actions"); async function isSelectorObjectVisible(selector, page, options) { if (!page) { throw new Error(`Cannot get visibility status of '${selector.toString()}' because no browser has been launched`); } (0, utils_1.report)('waiting for the selector to appear in DOM ...', options.verbose); await (0, utils_1.waitUntil)(() => selector.exists(), `Cannot get visibility status of '${selector.toString()}' because this selector was not found in DOM`, options); const handle = await selector.getHandle(); return await (0, handle_actions_1.isHandleVisible)(handle, { verbose: options.verbose }); } exports.isSelectorObjectVisible = isSelectorObjectVisible;