diff --git a/.changeset/modest-oyster-from-hyperborea.md b/.changeset/modest-oyster-from-hyperborea.md new file mode 100644 index 0000000..10d924c --- /dev/null +++ b/.changeset/modest-oyster-from-hyperborea.md @@ -0,0 +1,5 @@ +--- +"stagehand": patch +--- + +Fix variable replacement in actHandler diff --git a/pyproject.toml b/pyproject.toml index 36aa5c3..fef8501 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "stagehand" -version = "0.5.9" +version = "0.5.10" description = "Python SDK for Stagehand" readme = "README.md" classifiers = [ "Programming Language :: Python :: 3", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent",] diff --git a/stagehand/handlers/act_handler.py b/stagehand/handlers/act_handler.py index d6a7cca..8d530ea 100644 --- a/stagehand/handlers/act_handler.py +++ b/stagehand/handlers/act_handler.py @@ -96,7 +96,7 @@ async def act(self, options: Union[ActOptions, ObserveResult]) -> ActResult: if options.get("variables"): variables = options.get("variables", {}) element_to_act_on.arguments = [ - str(arg).replace(f"%{key}%", str(value)) + str(arg).replace(f"{key}", str(value)) for arg in element_to_act_on.arguments or [] for key, value in variables.items() ]