Skip to content

variables not being used in playwright commandsΒ #230

@rynonl

Description

@rynonl

Before submitting an issue, please:

Environment Information

Please provide the following information to help us reproduce and resolve your issue:

Stagehand:

  • Language/SDK: Python
  • Stagehand version: 0.5.4

AI Provider:

  • Provider: Anthropic
  • Model: claude-haiku-4-5-20251001

Issue Description

The code indicates that I can pass a variables argument to both act and observe so that I can keep sensitive data out of the LLM, just like with the Typescript SDK (docs).

When I pass a variables dict:

page.act(Enter %employer_legal_name% in the 'Contract name' field, variables={"employer_legal_name": "foo"})

The prompt correctly tells the LLM that the variables are available, and the observe result comes back like:

"{""selector"": ""xpath=/html/body[1]/table[2]/tbody[1]/tr[1]/td[3]/table[1]/tbody[1]/tr[6]/td[3]/table[1]/tbody[1]/tr[2]/td[2]/p[1]/input[1]"", ""description"": ""The 'Contract name' textbox field where the employer legal name should be entered"", ""backend_node_id"": null, ""method"": ""fill"", ""arguments"": [""%employer_legal_name%""]}"

where "employer_legal_name" was the name of my variable.

However, when the playwright portion runs, it uses the string literal "employer_legal_name" rather than resolving the value of that key in my variables dict.

Steps to Reproduce

  1. Pass variables to act or observe
  2. Observe that the variable key is used in the resulting playwright command, rather than the variable value

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions