playwright-fluent
Version:
Fluent API around playwright
24 lines (23 loc) • 974 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.invokeMethodOnSelector = exports.defaultInvokeOptions = void 0;
const handle_actions_1 = require("../../handle-actions");
const get_handle_of_1 = require("../get-handle-of");
const utils_1 = require("../../../utils");
exports.defaultInvokeOptions = {
stabilityInMilliseconds: 300,
timeoutInMilliseconds: 30000,
verbose: false,
};
async function invokeMethodOnSelector(methodName, selector, page, options) {
if (!page) {
throw new Error(`Cannot invoke method '${methodName}' on '${selector}' because no browser has been launched`);
}
const waitOptions = {
...utils_1.defaultWaitUntilOptions,
...options,
};
const handle = await (0, get_handle_of_1.getHandleOf)(selector, page, waitOptions);
await (0, handle_actions_1.invokeMethodOnHandle)(methodName, handle, selector);
}
exports.invokeMethodOnSelector = invokeMethodOnSelector;
;