n8n-nodes-smart-browser-automation 1.1.2 → 1.1.3
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.
|
@@ -221,7 +221,10 @@ class SmartBrowserAutomation {
|
|
|
221
221
|
const sessionManager = BrowserSessionManager_1.default.getInstance();
|
|
222
222
|
const credentials = await this.getCredentials('smartBrowserAutomationApi');
|
|
223
223
|
await sessionManager.initialize(credentials.mcpEndpoint, true, input.endpoint);
|
|
224
|
-
return {
|
|
224
|
+
return {
|
|
225
|
+
content: [{ type: 'text', text: `Successfully connected to browser at ${input.endpoint}` }],
|
|
226
|
+
isError: false
|
|
227
|
+
};
|
|
225
228
|
}
|
|
226
229
|
};
|
|
227
230
|
return [connectTool, ...tools];
|
|
@@ -276,11 +279,7 @@ class SmartBrowserAutomation {
|
|
|
276
279
|
}
|
|
277
280
|
const result = await sessionManager.callTool(toolName, toolArgs);
|
|
278
281
|
returnData.push({
|
|
279
|
-
json:
|
|
280
|
-
success: true,
|
|
281
|
-
tool: toolName,
|
|
282
|
-
result,
|
|
283
|
-
},
|
|
282
|
+
json: result,
|
|
284
283
|
pairedItem: i,
|
|
285
284
|
});
|
|
286
285
|
}
|
|
@@ -297,10 +296,10 @@ class SmartBrowserAutomation {
|
|
|
297
296
|
// New logic: Auto-call browser_connect tool if a URL is provided
|
|
298
297
|
if (options.cdpUrl) {
|
|
299
298
|
if (verbose) {
|
|
300
|
-
console.log(`Auto-calling '
|
|
299
|
+
console.log(`Auto-calling 'browser_connect_cdp' with endpoint: ${options.cdpUrl}`);
|
|
301
300
|
}
|
|
302
301
|
try {
|
|
303
|
-
await sessionManager.callTool('
|
|
302
|
+
await sessionManager.callTool('browser_connect_cdp', { endpoint: options.cdpUrl });
|
|
304
303
|
}
|
|
305
304
|
catch (error) {
|
|
306
305
|
console.warn(`Failed to auto-connect browser via tool: ${error.message}`);
|
|
@@ -66,16 +66,10 @@ async function createDynamicBrowserTools(credentials) {
|
|
|
66
66
|
async execute(toolInput) {
|
|
67
67
|
try {
|
|
68
68
|
const result = await sessionManager.callTool(toolName, toolInput);
|
|
69
|
-
return
|
|
70
|
-
success: true,
|
|
71
|
-
result: JSON.stringify(result, null, 2),
|
|
72
|
-
};
|
|
69
|
+
return result;
|
|
73
70
|
}
|
|
74
71
|
catch (error) {
|
|
75
|
-
|
|
76
|
-
success: false,
|
|
77
|
-
error: error.message || 'Unknown error occurred',
|
|
78
|
-
};
|
|
72
|
+
throw new Error(error.message || 'Unknown error occurred');
|
|
79
73
|
}
|
|
80
74
|
}
|
|
81
75
|
};
|