UNPKG

playwright-selector-finder

Version:

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

44 lines (43 loc) 1.65 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 }); const commander_1 = require("commander"); const server_1 = require("./server"); const program = new commander_1.Command(); program .name('playwright-selector-finder') .version('1.0.1') .option('--headless', 'Run in headless mode', false) .option('--vision-timeout <ms>', 'Vision locator timeout in milliseconds', '5000') .option('--vision-confidence <threshold>', 'Vision locator confidence threshold', '0.7') .action(async (options) => { const server = new server_1.MCPServer({ headless: options.headless, visionTimeout: parseInt(options.visionTimeout ?? '5000', 10), visionConfidence: parseFloat(options.visionConfidence ?? '0.7') }); await server.start(); // Handle process exit const cleanup = async () => { await server.stop(); process.exit(0); }; process.on('SIGINT', cleanup); process.on('SIGTERM', cleanup); process.on('SIGHUP', cleanup); }); program.parse();