playwright-fluent
Version:
Fluent API around playwright
16 lines (15 loc) • 629 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getHandleOf = void 0;
const utils_1 = require("../../../utils");
const dom_actions_1 = require("../../dom-actions");
async function getHandleOf(selector, page, options) {
if (!page) {
return null;
}
(0, utils_1.report)('waiting for the selector to appear in DOM ...', options.verbose);
await (0, utils_1.waitUntil)(() => (0, dom_actions_1.exists)(selector, page), `Selector '${selector}' was not found in DOM`, options);
const handle = await page.$(selector);
return handle;
}
exports.getHandleOf = getHandleOf;