UNPKG

playwright-fluent

Version:
19 lines (18 loc) 887 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.selectorObjectExists = void 0; const handle_actions_1 = require("../../handle-actions"); const utils_1 = require("../../../utils"); async function selectorObjectExists(selector, page, options) { if (!page) { throw new Error(`Cannot check that '${selector.toString()}' exists 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 check that '${selector.toString()}' exists because this selector was not found in DOM`, { ...options, throwOnTimeout: false, }); const handle = await selector.getHandle(); return await (0, handle_actions_1.handleExists)(handle); } exports.selectorObjectExists = selectorObjectExists;