Skip to content

Commit d61968b

Browse files
authored
Fix error in press_key act util function (#155)
* Fix error in press_key act util function * Use stagehand page keyboard instead of locator
1 parent 04cd8da commit d61968b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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)