n8n-nodes-playwright-mcp
Version:
Complete n8n Playwright node with all Microsoft Playwright MCP tools and AI assistant support for advanced browser automation
31 lines • 1.15 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.getBrowserExecutablePath = getBrowserExecutablePath;
const path_1 = require("path");
const config_1 = require("./config");
const os_1 = require("os");
const fs_1 = require("fs");
function getBrowserExecutablePath(browserType, basePath) {
const os = (0, os_1.platform)();
const files = (0, fs_1.readdirSync)(basePath);
const browserDir = files.find(f => f.startsWith(browserType));
if (!browserDir) {
throw new Error(`Browser ${browserType} not found in ${basePath}`);
}
let pathSegments;
switch (os) {
case 'win32':
pathSegments = config_1.browserPaths[browserType].windows;
break;
case 'linux':
pathSegments = config_1.browserPaths[browserType].linux;
break;
case 'darwin':
pathSegments = config_1.browserPaths[browserType].darwin;
break;
default:
throw new Error(`Unsupported operating system: ${os}`);
}
return (0, path_1.join)(basePath, browserDir, ...pathSegments);
}
//# sourceMappingURL=utils.js.map
;