Skip to content

Commit 8d55709

Browse files
miguelg719Zach10za
andauthored
Fix error in press_key act util function (#155) (#157)
* Fix error in press_key act util function (#155) * Fix error in press_key act util function * Use stagehand page keyboard instead of locator * changeset --------- Co-authored-by: Zach Loza <Zach10za@users.noreply.github.com>
1 parent 04cd8da commit 8d55709

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.changeset/sceptical-mutant-shrew.md

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 error in press_key act util function

stagehand/handlers/act_handler_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ async def fill_or_type(ctx: MethodHandlerContext) -> None:
307307
async def press_key(ctx: MethodHandlerContext) -> None:
308308
try:
309309
key = str(ctx.args[0]) if ctx.args and ctx.args[0] is not None else ""
310-
await ctx.locator._page.keyboard.press(key)
310+
await ctx.stagehand_page._page.keyboard.press(key)
311311
await handle_possible_page_navigation(
312312
"press",
313313
ctx.xpath,
@@ -398,7 +398,7 @@ async def fallback_locator_method(ctx: MethodHandlerContext) -> None:
398398
ctx.logger.debug(
399399
message="page URL before action",
400400
category="action",
401-
auxiliary={"url": {"value": ctx.locator._page.url, "type": "string"}},
401+
auxiliary={"url": {"value": ctx.stagehand_page._page.url, "type": "string"}},
402402
)
403403
try:
404404
method_to_call = getattr(ctx.locator, ctx.method)

0 commit comments

Comments
 (0)