Skip to content

Commit 057b38b

Browse files
miguelg719Zach10za
andauthored
Dump ObserveResult to dict before passing to draw_overlay (#198) (#201)
* Dump ObserveResult to dict before passing to draw_overlay (#198) * changeset: --------- Co-authored-by: Zach Loza <[email protected]>
1 parent 93f5c97 commit 057b38b

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"stagehand": patch
3+
---
4+
5+
Fix draw_overlay on env:LOCAL

stagehand/handlers/observe_handler.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,10 @@ async def observe(
118118

119119
# Draw overlay if requested
120120
if options.draw_overlay:
121-
await draw_observe_overlay(self.stagehand_page, elements_with_selectors)
121+
await draw_observe_overlay(
122+
page=self.stagehand_page,
123+
elements=[el.model_dump() for el in elements_with_selectors],
124+
)
122125

123126
# Return the list of results without trying to attach _llm_response
124127
return elements_with_selectors

stagehand/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def format_simplified_tree(node: AccessibilityNode, level: int = 0) -> str:
109109
return result
110110

111111

112-
async def draw_observe_overlay(page, elements):
112+
async def draw_observe_overlay(page, elements: list[dict]):
113113
"""
114114
Draw an overlay on the page highlighting the observed elements.
115115

0 commit comments

Comments
 (0)