Skip to content

Commit a45fad9

Browse files
committed
remove console.log statements
1 parent 7c5734b commit a45fad9

File tree

1 file changed

+0
-38
lines changed

1 file changed

+0
-38
lines changed

lib/handlers/agentHandler.ts

-38
Original file line numberDiff line numberDiff line change
@@ -277,16 +277,13 @@ export class StagehandAgentHandler {
277277
case "keypress": {
278278
const { keys } = action;
279279
if (Array.isArray(keys)) {
280-
console.log("[Keypress] Received keys:", keys);
281-
282280
// Check if CTRL or CMD is present in the keys
283281
const hasModifier = keys.some(
284282
(key) =>
285283
key.includes("CTRL") ||
286284
key.includes("CMD") ||
287285
key.includes("COMMAND"),
288286
);
289-
console.log("[Keypress] Has modifier keys:", hasModifier);
290287

291288
if (hasModifier) {
292289
// Handle key combination - press all keys simultaneously
@@ -298,87 +295,52 @@ export class StagehandAgentHandler {
298295
return "Meta";
299296
return this.convertKeyName(key);
300297
});
301-
console.log(
302-
"[Keypress] Converted to Playwright keys:",
303-
playwrightKeys,
304-
);
305298

306299
// Press all keys down in sequence
307-
console.log("[Keypress] Pressing keys down in sequence...");
308300
for (const key of playwrightKeys) {
309-
console.log("[Keypress] Pressing down:", key);
310301
await this.stagehandPage.page.keyboard.down(key);
311302
}
312303

313304
// Small delay to ensure the combination is registered
314-
console.log(
315-
"[Keypress] Waiting for combination to register...",
316-
);
317305
await new Promise((resolve) => setTimeout(resolve, 100));
318306

319307
// Release all keys in reverse order
320-
console.log("[Keypress] Releasing keys in reverse order...");
321308
for (const key of playwrightKeys.reverse()) {
322-
console.log("[Keypress] Releasing:", key);
323309
await this.stagehandPage.page.keyboard.up(key);
324310
}
325-
console.log(
326-
"[Keypress] Key combination completed successfully",
327-
);
328311
} catch (error) {
329-
console.error(
330-
"[Keypress] Error executing key combination:",
331-
error,
332-
);
333312
throw error;
334313
}
335314
} else {
336315
// Handle individual keys as before
337-
console.log("[Keypress] Processing individual keys...");
338316
for (const key of keys) {
339-
console.log("[Keypress] Processing key:", key);
340317
// Handle special keys
341318
if (key.includes("ENTER")) {
342-
console.log("[Keypress] Pressing special key: Enter");
343319
await this.stagehandPage.page.keyboard.press("Enter");
344320
} else if (key.includes("SPACE")) {
345-
console.log("[Keypress] Pressing special key: Space");
346321
await this.stagehandPage.page.keyboard.press(" ");
347322
} else if (key.includes("TAB")) {
348-
console.log("[Keypress] Pressing special key: Tab");
349323
await this.stagehandPage.page.keyboard.press("Tab");
350324
} else if (key.includes("ESCAPE") || key.includes("ESC")) {
351-
console.log("[Keypress] Pressing special key: Escape");
352325
await this.stagehandPage.page.keyboard.press("Escape");
353326
} else if (key.includes("BACKSPACE")) {
354-
console.log("[Keypress] Pressing special key: Backspace");
355327
await this.stagehandPage.page.keyboard.press("Backspace");
356328
} else if (key.includes("DELETE")) {
357-
console.log("[Keypress] Pressing special key: Delete");
358329
await this.stagehandPage.page.keyboard.press("Delete");
359330
} else if (key.includes("ARROW_UP")) {
360-
console.log("[Keypress] Pressing special key: ArrowUp");
361331
await this.stagehandPage.page.keyboard.press("ArrowUp");
362332
} else if (key.includes("ARROW_DOWN")) {
363-
console.log("[Keypress] Pressing special key: ArrowDown");
364333
await this.stagehandPage.page.keyboard.press("ArrowDown");
365334
} else if (key.includes("ARROW_LEFT")) {
366-
console.log("[Keypress] Pressing special key: ArrowLeft");
367335
await this.stagehandPage.page.keyboard.press("ArrowLeft");
368336
} else if (key.includes("ARROW_RIGHT")) {
369-
console.log("[Keypress] Pressing special key: ArrowRight");
370337
await this.stagehandPage.page.keyboard.press("ArrowRight");
371338
} else {
372339
// For other keys, use the existing conversion
373340
const playwrightKey = this.convertKeyName(key);
374-
console.log(
375-
"[Keypress] Pressing converted key:",
376-
playwrightKey,
377-
);
378341
await this.stagehandPage.page.keyboard.press(playwrightKey);
379342
}
380343
}
381-
console.log("[Keypress] Finished processing all individual keys");
382344
}
383345
}
384346
return { success: true };

0 commit comments

Comments
 (0)