Skip to content

Agent can't select items from select element. #1238

@spegoraro

Description

@spegoraro

Before submitting an issue, please:

Environment Information

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

Stagehand:

  • Language/SDK: Typescript
  • Stagehand version: 3.0.1

AI Provider:

  • Provider: any (tested with Gemini and Claude Sonnet latest)
  • Model: any (use anthropic/claude-sonnet-4-5-20250929 for an example)

Issue Description

When asking an agent to fill in a form that contains select elements it attempts to click the box but the options never show up so the agent gets stuck in a loop of scrolling down, scrolling back up, then clicking again. This may be related to #823

Steps to Reproduce

  1. Create a stagehand session
  2. Navigate to a form with dropdowns
  3. Prompt the agent to fill in the form
  4. Observe the issue behaviour

Minimal Reproduction Code

import "dotenv/config";
import { Stagehand } from "@browserbasehq/stagehand";
import { z } from "zod/v3";

async function main() {
  const model = "<MODEL_ID>";
  const apiKey = "<MODEL_API_KEY>";
  const stagehand = new Stagehand({
    env: "BROWSERBASE",
    model,
    apiKey
  });

  await stagehand.init();
  const page = stagehand.context.pages()[0];
  const agent = stagehand.agent({
    cua: true,
    model: {
      modelName: model,
      apiKey,
    },
  });

  await page.goto(
    "https://www.ato.gov.au/single-page-applications/calculatorsandtools?anchor=STC#STC/questions"
  );
  const result = await agent.execute({
    instruction:
      "Fill in the tax estimator form assuming the previous tax year, a total taxable income of $150,000AUD and full-year tax residency. Once filled, submit the form and extract the estimated tax payable.",
    page,
    maxSteps: 30,
  });

  console.log(result);
  await stagehand.close();
}

main().catch((err) => {
  console.error(err);
  process.exit(1);
});

Error Messages / Log trace

No error, just incorrect behaviour.

Screenshots / Videos

Nil

Related Issues

Are there any related issues or PRs?

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