Skip to content

Commit 8ff5c5a

Browse files
authored
Improve failed act logs (#1090)
1 parent 536f366 commit 8ff5c5a

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

.changeset/tasty-candles-retire.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@browserbasehq/stagehand": patch
3+
---
4+
5+
Improve failed act error logs

lib/handlers/actHandler.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ export class StagehandActHandler {
163163
if (observeResults.length === 0) {
164164
return {
165165
success: false,
166-
message: `Failed to self heal act: No observe results found for action`,
166+
message: `Failed to self heal act: Element not found.`,
167167
action: actCommand,
168168
};
169169
}
@@ -264,9 +264,15 @@ export class StagehandActHandler {
264264
});
265265

266266
if (observeResults.length === 0) {
267+
this.logger({
268+
category: "action",
269+
message:
270+
"No elements found to act on. Check best practices for act: https://docs.stagehand.com/basics/act",
271+
level: 2,
272+
});
267273
return {
268274
success: false,
269-
message: `Failed to perform act: No observe results found for action`,
275+
message: `Failed to perform act: No elements found to act on.`,
270276
action,
271277
};
272278
}

0 commit comments

Comments
 (0)