@democratize-quality/mcp-server 1.1.9 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/server.d.ts +41 -0
  2. package/dist/server.d.ts.map +1 -0
  3. package/dist/server.js +225 -0
  4. package/dist/server.js.map +1 -0
  5. package/package.json +23 -24
  6. package/browserControl.js +0 -113
  7. package/cli.js +0 -228
  8. package/mcpServer.js +0 -335
  9. package/run-server.js +0 -140
  10. package/src/chatmodes//360/237/214/220 api-generator.chatmode.md" +0 -409
  11. package/src/chatmodes//360/237/214/220 api-healer.chatmode.md" +0 -494
  12. package/src/chatmodes//360/237/214/220 api-planner.chatmode.md" +0 -954
  13. package/src/config/environments/api-only.js +0 -53
  14. package/src/config/environments/development.js +0 -54
  15. package/src/config/environments/production.js +0 -69
  16. package/src/config/index.js +0 -341
  17. package/src/config/server.js +0 -41
  18. package/src/config/tools/api.js +0 -67
  19. package/src/config/tools/browser.js +0 -90
  20. package/src/config/tools/default.js +0 -32
  21. package/src/docs/Agent_README.md +0 -310
  22. package/src/docs/QUICK_REFERENCE.md +0 -111
  23. package/src/services/browserService.js +0 -325
  24. package/src/skills/api-planning/SKILL.md +0 -224
  25. package/src/skills/test-execution/SKILL.md +0 -777
  26. package/src/skills/test-generation/SKILL.md +0 -309
  27. package/src/skills/test-healing/SKILL.md +0 -405
  28. package/src/tools/api/api-generator.js +0 -1865
  29. package/src/tools/api/api-healer.js +0 -617
  30. package/src/tools/api/api-planner.js +0 -2598
  31. package/src/tools/api/api-project-setup.js +0 -313
  32. package/src/tools/api/api-request.js +0 -641
  33. package/src/tools/api/api-session-report.js +0 -1278
  34. package/src/tools/api/api-session-status.js +0 -395
  35. package/src/tools/api/prompts/README.md +0 -293
  36. package/src/tools/api/prompts/generation-prompts.js +0 -703
  37. package/src/tools/api/prompts/healing-prompts.js +0 -195
  38. package/src/tools/api/prompts/index.js +0 -25
  39. package/src/tools/api/prompts/orchestrator.js +0 -334
  40. package/src/tools/api/prompts/validation-rules.js +0 -339
  41. package/src/tools/base/ToolBase.js +0 -230
  42. package/src/tools/base/ToolRegistry.js +0 -269
  43. package/src/tools/browser/advanced/browser-console.js +0 -384
  44. package/src/tools/browser/advanced/browser-dialog.js +0 -319
  45. package/src/tools/browser/advanced/browser-evaluate.js +0 -337
  46. package/src/tools/browser/advanced/browser-file.js +0 -480
  47. package/src/tools/browser/advanced/browser-keyboard.js +0 -343
  48. package/src/tools/browser/advanced/browser-mouse.js +0 -332
  49. package/src/tools/browser/advanced/browser-network.js +0 -421
  50. package/src/tools/browser/advanced/browser-pdf.js +0 -407
  51. package/src/tools/browser/advanced/browser-tabs.js +0 -497
  52. package/src/tools/browser/advanced/browser-wait.js +0 -378
  53. package/src/tools/browser/click.js +0 -168
  54. package/src/tools/browser/close.js +0 -60
  55. package/src/tools/browser/dom.js +0 -70
  56. package/src/tools/browser/launch.js +0 -67
  57. package/src/tools/browser/navigate.js +0 -270
  58. package/src/tools/browser/screenshot.js +0 -351
  59. package/src/tools/browser/type.js +0 -174
  60. package/src/tools/index.js +0 -95
  61. package/src/utils/agentInstaller.js +0 -418
  62. package/src/utils/browserHelpers.js +0 -83
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Copyright (C) 2025 Democratize Quality
4
+ *
5
+ * This file is part of Democratize Quality MCP Server.
6
+ *
7
+ * Democratize Quality MCP Server is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU Affero General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * Democratize Quality MCP Server is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU Affero General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Affero General Public License
18
+ * along with Democratize Quality MCP Server. If not, see <https://www.gnu.org/licenses/>.
19
+ */
20
+ interface ServerConfig {
21
+ enableDebugMode?: boolean;
22
+ enableApiTools?: boolean;
23
+ enableBrowserTools?: boolean;
24
+ enableAdvancedTools?: boolean;
25
+ }
26
+ declare class DemocratizeQualityMCPServer {
27
+ private server;
28
+ private toolDefinitions;
29
+ private config;
30
+ private isDebugMode;
31
+ constructor(serverConfig?: ServerConfig);
32
+ private debugLog;
33
+ private log;
34
+ private setupHandlers;
35
+ private getAvailableTools;
36
+ initialize(): Promise<void>;
37
+ start(): Promise<void>;
38
+ stop(): Promise<void>;
39
+ }
40
+ export { DemocratizeQualityMCPServer };
41
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;GAiBG;AA0BH,UAAU,YAAY;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,cAAM,2BAA2B;IAC/B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,eAAe,CAAa;IACpC,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,WAAW,CAAU;gBAEjB,YAAY,GAAE,YAAiB;IA4B3C,OAAO,CAAC,QAAQ;IAMhB,OAAO,CAAC,GAAG;IAIX,OAAO,CAAC,aAAa;IA4CrB,OAAO,CAAC,iBAAiB;IAkBnB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAkB3B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IActB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAQ5B;AAmCD,OAAO,EAAE,2BAA2B,EAAE,CAAC"}
package/dist/server.js ADDED
@@ -0,0 +1,225 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ /**
4
+ * Copyright (C) 2025 Democratize Quality
5
+ *
6
+ * This file is part of Democratize Quality MCP Server.
7
+ *
8
+ * Democratize Quality MCP Server is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU Affero General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * Democratize Quality MCP Server is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU Affero General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Affero General Public License
19
+ * along with Democratize Quality MCP Server. If not, see <https://www.gnu.org/licenses/>.
20
+ */
21
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
22
+ if (k2 === undefined) k2 = k;
23
+ var desc = Object.getOwnPropertyDescriptor(m, k);
24
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
25
+ desc = { enumerable: true, get: function() { return m[k]; } };
26
+ }
27
+ Object.defineProperty(o, k2, desc);
28
+ }) : (function(o, m, k, k2) {
29
+ if (k2 === undefined) k2 = k;
30
+ o[k2] = m[k];
31
+ }));
32
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
33
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
34
+ }) : function(o, v) {
35
+ o["default"] = v;
36
+ });
37
+ var __importStar = (this && this.__importStar) || (function () {
38
+ var ownKeys = function(o) {
39
+ ownKeys = Object.getOwnPropertyNames || function (o) {
40
+ var ar = [];
41
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
42
+ return ar;
43
+ };
44
+ return ownKeys(o);
45
+ };
46
+ return function (mod) {
47
+ if (mod && mod.__esModule) return mod;
48
+ var result = {};
49
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
50
+ __setModuleDefault(result, mod);
51
+ return result;
52
+ };
53
+ })();
54
+ Object.defineProperty(exports, "__esModule", { value: true });
55
+ exports.DemocratizeQualityMCPServer = void 0;
56
+ /**
57
+ * @democratize-quality/mcp-server
58
+ * Main MCP server implementation for API testing and browser automation
59
+ */
60
+ const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
61
+ const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
62
+ const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
63
+ const path = __importStar(require("path"));
64
+ // Import existing CommonJS modules - use paths relative to project root
65
+ // When compiled, this will be in dist/, so we need to go up one level to find src/
66
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
67
+ const browserService = require(path.join(__dirname, '..', 'src', 'services', 'browserService.js'));
68
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
69
+ const toolsModule = require(path.join(__dirname, '..', 'src', 'tools', 'index.js'));
70
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
71
+ const config = require(path.join(__dirname, '..', 'src', 'config', 'index.js'));
72
+ class DemocratizeQualityMCPServer {
73
+ server;
74
+ toolDefinitions = [];
75
+ config;
76
+ isDebugMode;
77
+ constructor(serverConfig = {}) {
78
+ // Check if debug mode is requested via environment variable
79
+ const debugFromEnv = process.env.MCP_FEATURES_ENABLEDEBUGMODE === 'true' ||
80
+ process.env.NODE_ENV === 'development';
81
+ this.isDebugMode = config.get('features.enableDebugMode', false) || debugFromEnv || serverConfig.enableDebugMode || false;
82
+ // Set quiet mode if not in debug
83
+ config.setQuiet(!this.isDebugMode);
84
+ this.config = serverConfig;
85
+ // Initialize MCP Server with SDK
86
+ this.server = new index_js_1.Server({
87
+ name: '@democratize-quality/mcp-server',
88
+ version: '1.2.0',
89
+ }, {
90
+ capabilities: {
91
+ tools: {},
92
+ },
93
+ });
94
+ this.setupHandlers();
95
+ }
96
+ debugLog(...args) {
97
+ if (this.isDebugMode) {
98
+ console.error('[Democratize Quality MCP]', ...args);
99
+ }
100
+ }
101
+ log(...args) {
102
+ console.error('[Democratize Quality MCP]', ...args);
103
+ }
104
+ setupHandlers() {
105
+ // List available tools
106
+ this.server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => {
107
+ this.debugLog(`Received 'tools/list' request.`);
108
+ this.debugLog(`Returning ${this.toolDefinitions.length} tools`);
109
+ return {
110
+ tools: this.getAvailableTools(),
111
+ };
112
+ });
113
+ // Handle tool calls
114
+ this.server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
115
+ const { name, arguments: args } = request.params;
116
+ this.debugLog(`Received 'tools/call' for method: ${name}`);
117
+ try {
118
+ // Use the existing tool system to execute the tool
119
+ const result = await toolsModule.executeTool(name, args || {});
120
+ return {
121
+ content: [
122
+ {
123
+ type: 'text',
124
+ text: typeof result === 'string' ? result : JSON.stringify(result, null, 2),
125
+ },
126
+ ],
127
+ };
128
+ }
129
+ catch (error) {
130
+ this.log(`Error executing tool '${name}':`, error.message);
131
+ return {
132
+ content: [
133
+ {
134
+ type: 'text',
135
+ text: `Error executing ${name}: ${error.message}`,
136
+ },
137
+ ],
138
+ isError: true,
139
+ };
140
+ }
141
+ });
142
+ }
143
+ getAvailableTools() {
144
+ // Convert existing tool definitions to MCP SDK format
145
+ return this.toolDefinitions.map((tool) => {
146
+ const sdkTool = {
147
+ name: tool.name,
148
+ description: tool.description,
149
+ inputSchema: {
150
+ type: 'object',
151
+ properties: tool.input_schema?.properties || tool.inputSchema?.properties || {},
152
+ ...(tool.input_schema?.required && tool.input_schema.required.length > 0
153
+ ? { required: tool.input_schema.required }
154
+ : {}),
155
+ },
156
+ };
157
+ return sdkTool;
158
+ });
159
+ }
160
+ async initialize() {
161
+ try {
162
+ this.debugLog('Initializing tool system...');
163
+ // Initialize the existing tool system
164
+ await toolsModule.initializeTools(this.isDebugMode);
165
+ // Get tool definitions from the existing system
166
+ this.toolDefinitions = toolsModule.getToolDefinitions();
167
+ this.log(`Tool system initialized with ${this.toolDefinitions.length} tools`);
168
+ }
169
+ catch (error) {
170
+ this.log('Failed to initialize tool system:', error.message);
171
+ throw error;
172
+ }
173
+ }
174
+ async start() {
175
+ // Initialize tools first
176
+ await this.initialize();
177
+ // Create transport and connect
178
+ const transport = new stdio_js_1.StdioServerTransport();
179
+ await this.server.connect(transport);
180
+ this.log('Server started and ready');
181
+ if (this.isDebugMode) {
182
+ this.log('Debug mode enabled - showing detailed logs');
183
+ }
184
+ }
185
+ async stop() {
186
+ try {
187
+ await browserService.shutdownAllBrowsers();
188
+ this.log('All browser instances closed');
189
+ }
190
+ catch (error) {
191
+ this.log('Error during shutdown:', error.message);
192
+ }
193
+ }
194
+ }
195
+ exports.DemocratizeQualityMCPServer = DemocratizeQualityMCPServer;
196
+ // Main entry point
197
+ async function main() {
198
+ const server = new DemocratizeQualityMCPServer();
199
+ // Handle graceful shutdown
200
+ process.on('SIGINT', async () => {
201
+ console.error('\nSIGINT received. Shutting down...');
202
+ await server.stop();
203
+ process.exit(0);
204
+ });
205
+ process.on('SIGTERM', async () => {
206
+ console.error('\nSIGTERM received. Shutting down...');
207
+ await server.stop();
208
+ process.exit(0);
209
+ });
210
+ try {
211
+ await server.start();
212
+ }
213
+ catch (error) {
214
+ console.error('Failed to start server:', error);
215
+ process.exit(1);
216
+ }
217
+ }
218
+ // Start the server if this file is being executed directly
219
+ if (require.main === module) {
220
+ main().catch((error) => {
221
+ console.error('Unhandled error:', error);
222
+ process.exit(1);
223
+ });
224
+ }
225
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;AAEA;;;;;;;;;;;;;;;;;GAiBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH;;;GAGG;AAEH,wEAAmE;AACnE,wEAAiF;AACjF,iEAI4C;AAC5C,2CAA6B;AAE7B,wEAAwE;AACxE,mFAAmF;AACnF,8DAA8D;AAC9D,MAAM,cAAc,GAAG,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AAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;QAC/B,OAAO,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAC;QACtD,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;QAChD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,2DAA2D;AAC3D,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC5B,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QACrB,OAAO,CAAC,KAAK,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;QACzC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,17 +1,13 @@
1
1
  {
2
2
  "name": "@democratize-quality/mcp-server",
3
- "version": "1.1.9",
4
- "main": "mcpServer.js",
3
+ "version": "1.2.0",
4
+ "main": "dist/server.js",
5
5
  "bin": {
6
- "democratize-quality-mcp": "cli.js",
7
- "dq-mcp-server": "cli.js"
6
+ "democratize-quality-mcp": "./dist/server.js",
7
+ "dq-mcp-server": "./dist/server.js"
8
8
  },
9
9
  "files": [
10
- "mcpServer.js",
11
- "run-server.js",
12
- "cli.js",
13
- "browserControl.js",
14
- "src/",
10
+ "dist/",
15
11
  "docs/",
16
12
  "README.md",
17
13
  "LICENSE"
@@ -20,21 +16,21 @@
20
16
  "access": "public"
21
17
  },
22
18
  "scripts": {
19
+ "build": "npm run clean && tsc && npm run make-executable",
20
+ "make-executable": "node -e \"import('fs').then(fs => fs.chmodSync('dist/server.js', '755'))\"",
21
+ "clean": "rm -rf dist",
22
+ "dev": "tsc --watch",
23
+ "start": "node dist/server.js",
24
+ "mcp": "node dist/server.js",
25
+ "mcp:debug": "MCP_FEATURES_ENABLEDEBUGMODE=true node dist/server.js",
23
26
  "test": "node test-mcp.js",
24
27
  "docs:generate": "node scripts/generate-docs.js",
25
28
  "docs:watch": "nodemon scripts/generate-docs.js",
26
29
  "docs:clean": "rm -rf docs/",
27
- "start": "NODE_ENV=production node mcpServer.js",
28
- "mcp": "NODE_ENV=production node mcpServer.js",
29
- "mcp:debug": "MCP_FEATURES_ENABLEDEBUGMODE=true node mcpServer.js",
30
- "dev": "MCP_FEATURES_ENABLEDEBUGMODE=true node mcpServer.js",
31
- "server": "node run-server.js",
32
- "server:debug": "node run-server.js --debug",
33
- "server:prod": "node run-server.js --production",
34
- "inspector": "npx @modelcontextprotocol/inspector node mcpServer.js",
35
- "prepare-publish": "node prepare-publish.js",
36
- "prepublishOnly": "npm run prepare-publish",
37
- "postinstall": "echo '\n🎯 Democratize Quality MCP Server installed successfully!\n\nQuick start:\n npx @democratize-quality/mcp-server --help\n npx dq-mcp-server --help\n\nDocumentation: https://github.com/democratize-quality/mcp-server#readme\n'"
30
+ "inspector": "npx @modelcontextprotocol/inspector node dist/server.js",
31
+ "prepare": "npm run build",
32
+ "prepublishOnly": "npm run test",
33
+ "postinstall": "echo '\n🎯 Democratize Quality MCP Server installed successfully!\n\nQuick start:\n npx @democratize-quality/mcp-server\n npx dq-mcp-server\n\nDocumentation: https://github.com/democratize-quality/mcp-server#readme\n'"
38
34
  },
39
35
  "keywords": [
40
36
  "mcp",
@@ -70,17 +66,20 @@
70
66
  }
71
67
  },
72
68
  "dependencies": {
69
+ "@modelcontextprotocol/sdk": "^1.0.4",
73
70
  "@faker-js/faker": "^9.0.0",
74
- "body-parser": "^2.2.0",
75
71
  "chrome-launcher": "^1.2.0",
76
72
  "chrome-remote-interface": "^0.33.3",
77
- "express": "^5.1.0",
78
73
  "graphql": "^16.11.0",
79
- "json-rpc-2.0": "^1.7.1",
80
74
  "yaml": "^2.8.1",
81
75
  "zod": "^4.0.10"
82
76
  },
83
77
  "devDependencies": {
84
- "nodemon": "^3.1.10"
78
+ "@types/node": "^22.8.7",
79
+ "nodemon": "^3.1.10",
80
+ "typescript": "^5.6.3"
81
+ },
82
+ "engines": {
83
+ "node": ">=18.0.0"
85
84
  }
86
85
  }
package/browserControl.js DELETED
@@ -1,113 +0,0 @@
1
- // browserControl.js
2
- const CDP = require('chrome-remote-interface');
3
- const fs = require('fs');
4
- const path = require('path'); // We need path for resolving userDataDir
5
-
6
-
7
- async function automateBrowser() {
8
- let chrome;
9
- let client;
10
- const { launch: launchChrome } = await import('chrome-launcher');
11
- // Define your user data directory path
12
- // IMPORTANT: Create this directory if it doesn't exist before running the script
13
- const myUserDataDir = path.resolve(__dirname, './my_test_profile'); // This will create it in your project folder
14
-
15
- try {
16
- // Ensure the directory exists
17
- if (!fs.existsSync(myUserDataDir)) {
18
- fs.mkdirSync(myUserDataDir, { recursive: true });
19
- console.log(`Created user data directory: ${myUserDataDir}`);
20
- } else {
21
- console.log(`Using existing user data directory: ${myUserDataDir}`);
22
- }
23
-
24
- console.log('Launching Chrome with remote debugging...');
25
- chrome = await launchChrome({
26
- port: 9222,
27
- userDataDir: myUserDataDir, // <--- THE KEY CHANGE HERE
28
- chromeFlags: [
29
- // Set to false to see the browser UI
30
- // For initial login, it's highly recommended to use false so you can interact
31
- //'--headless=false', // Set this to 'new' or '' for headless mode once logged in
32
- '--disable-gpu',
33
- '--disable-setuid-sandbox',
34
- '--no-sandbox'
35
- ]
36
- });
37
- console.log(`Chrome launched on port ${chrome.port} using profile: ${myUserDataDir}`);
38
-
39
- client = await CDP({ port: chrome.port });
40
- console.log('Connected to Chrome DevTools Protocol.');
41
-
42
- const { Page, Runtime, DOM, Network } = client; // Also enable Network for potential cookie inspection later
43
-
44
- await Page.enable();
45
- await Runtime.enable();
46
- await DOM.enable();
47
- await Network.enable(); // Enable Network domain
48
-
49
- console.log('Page, Runtime, DOM, and Network domains enabled.');
50
-
51
- const url = 'https://www.saucedemo.com'; // You can change this to your company login page
52
- console.log(`Navigating to: ${url}`);
53
- await Page.navigate({ url: url });
54
- await Page.loadEventFired();
55
- console.log('Page loaded.');
56
-
57
- // --- Authentication Step ---
58
- // FIRST RUN:
59
- // When you run this for the first time with `--headless=false`,
60
- // a Chrome window will open. Manually navigate to your company's login page
61
- // and sign in. Complete all login steps (username, password, MFA, SSO etc.).
62
- // Once logged in, DO NOT close the browser manually.
63
- // Let the script finish, or press Ctrl+C to trigger the finally block.
64
- // The script will then close Chrome, and the session state will be saved
65
- // in 'my_test_profile' directory.
66
-
67
- // SUBSEQUENT RUNS:
68
- // For subsequent runs, you can change `--headless=false` to `--headless=new`
69
- // (or just remove it if you prefer `chrome-launcher`'s default headless behavior).
70
- // Chrome will launch, load the saved profile, and you should be logged in automatically.
71
- // You can then add your actual UI automation steps here, e.g., navigating to
72
- // internal dashboards, filling forms, etc.
73
-
74
- // Example: Wait for a few seconds so you can see the login happen
75
- console.log('Waiting for 10 seconds (for manual login/observation)...');
76
- await new Promise(resolve => setTimeout(resolve, 10000));
77
-
78
- // After the wait, take a screenshot to verify login state
79
- console.log('Taking screenshot after wait...');
80
- const screenshot = await Page.captureScreenshot({ format: 'png', quality: 80 });
81
- const screenshotBuffer = Buffer.from(screenshot.data, 'base64');
82
- fs.writeFileSync('example_screenshot_after_login.png', screenshotBuffer);
83
- console.log('Screenshot saved as example_screenshot_after_login.png');
84
-
85
- console.log('Getting page title...');
86
- const result = await Runtime.evaluate({ expression: 'document.title' });
87
- const pageTitle = result.result.value;
88
- console.log(`Page Title: "${pageTitle}"`);
89
-
90
- console.log('Getting outer HTML...');
91
- const documentNode = await DOM.getDocument({ depth: -1 });
92
- const outerHTML = await DOM.getOuterHTML({ nodeId: documentNode.root.nodeId });
93
- fs.writeFileSync('example_dom_after_login.html', outerHTML.outerHTML);
94
- console.log('DOM saved as example_dom_after_login.html');
95
-
96
-
97
- } catch (err) {
98
- console.error('CRITICAL ERROR during browser automation:', err.message);
99
- console.error('Details:', err);
100
- } finally {
101
- if (client) {
102
- console.log('Disconnecting CDP client...');
103
- client.close();
104
- }
105
- if (chrome) {
106
- console.log('Closing launched Chrome instance...');
107
- await chrome.kill();
108
- console.log('Chrome instance closed.');
109
- }
110
- }
111
- }
112
-
113
- automateBrowser();