Skip to content

Commit 8a05e10

Browse files
authored
Dump ObserveResult to dict before passing to draw_overlay (#198)
1 parent ab31b6e commit 8a05e10

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

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)