playwright-fluent
Version:
Fluent API around playwright
19 lines (18 loc) • 1.08 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.isSelectorObjectDisabled = void 0;
const utils_1 = require("../../../utils");
const handle_actions_1 = require("../../handle-actions");
async function isSelectorObjectDisabled(selector, page, options) {
if (!page) {
throw new Error(`Cannot get disabled 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 disabled status of '${selector.toString()}' because this selector was not found in DOM`, options);
const handle = await selector.getHandle();
const isDisabled = await (0, handle_actions_1.isHandleDisabled)(handle, { verbose: options.verbose });
const isReadOnly = await (0, handle_actions_1.isHandleReadOnly)(handle, { verbose: options.verbose });
const result = isDisabled || isReadOnly;
return result;
}
exports.isSelectorObjectDisabled = isSelectorObjectDisabled;
;