UNPKG

playwright-selector-finder

Version:

A tool for finding and interacting with elements using Playwright's vision locators

57 lines (56 loc) 2.98 kB
"use strict"; /** * Copyright (c) Microsoft Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.CloseTool = exports.SaveAsPDFTool = exports.WaitTool = exports.PressKeyTool = exports.TypeTool = exports.HoverTool = exports.ClickTool = exports.GoForwardTool = exports.GoBackTool = exports.NavigateTool = exports.Context = exports.MCPServer = void 0; const server_1 = require("./server"); const context_1 = require("./context"); Object.defineProperty(exports, "Context", { enumerable: true, get: function () { return context_1.Context; } }); const common_1 = require("./tools/common"); Object.defineProperty(exports, "NavigateTool", { enumerable: true, get: function () { return common_1.NavigateTool; } }); Object.defineProperty(exports, "GoBackTool", { enumerable: true, get: function () { return common_1.GoBackTool; } }); Object.defineProperty(exports, "GoForwardTool", { enumerable: true, get: function () { return common_1.GoForwardTool; } }); Object.defineProperty(exports, "ClickTool", { enumerable: true, get: function () { return common_1.ClickTool; } }); Object.defineProperty(exports, "HoverTool", { enumerable: true, get: function () { return common_1.HoverTool; } }); Object.defineProperty(exports, "TypeTool", { enumerable: true, get: function () { return common_1.TypeTool; } }); Object.defineProperty(exports, "PressKeyTool", { enumerable: true, get: function () { return common_1.PressKeyTool; } }); Object.defineProperty(exports, "WaitTool", { enumerable: true, get: function () { return common_1.WaitTool; } }); Object.defineProperty(exports, "SaveAsPDFTool", { enumerable: true, get: function () { return common_1.SaveAsPDFTool; } }); Object.defineProperty(exports, "CloseTool", { enumerable: true, get: function () { return common_1.CloseTool; } }); class MCPServer { server; constructor(options = {}) { this.server = new server_1.MCPServer({ headless: options.headless, visionTimeout: options.visionTimeout, visionConfidence: options.visionConfidence }); } async start() { await this.server.start(); } async stop() { await this.server.stop(); } async listTools() { return this.server.listTools(); } async callTool(name, params) { return this.server.callTool(name, params); } } exports.MCPServer = MCPServer; exports.default = MCPServer;