diff --git a/.changeset/sceptical-mutant-shrew.md b/.changeset/sceptical-mutant-shrew.md new file mode 100644 index 00000000..cd16941a --- /dev/null +++ b/.changeset/sceptical-mutant-shrew.md @@ -0,0 +1,5 @@ +--- +"stagehand": patch +--- + +Fix error in press_key act util function diff --git a/stagehand/handlers/act_handler_utils.py b/stagehand/handlers/act_handler_utils.py index 0455820b..947cf433 100644 --- a/stagehand/handlers/act_handler_utils.py +++ b/stagehand/handlers/act_handler_utils.py @@ -307,7 +307,7 @@ async def fill_or_type(ctx: MethodHandlerContext) -> None: async def press_key(ctx: MethodHandlerContext) -> None: try: key = str(ctx.args[0]) if ctx.args and ctx.args[0] is not None else "" - await ctx.locator._page.keyboard.press(key) + await ctx.stagehand_page._page.keyboard.press(key) await handle_possible_page_navigation( "press", ctx.xpath, @@ -398,7 +398,7 @@ async def fallback_locator_method(ctx: MethodHandlerContext) -> None: ctx.logger.debug( message="page URL before action", category="action", - auxiliary={"url": {"value": ctx.locator._page.url, "type": "string"}}, + auxiliary={"url": {"value": ctx.stagehand_page._page.url, "type": "string"}}, ) try: method_to_call = getattr(ctx.locator, ctx.method)