#1434·stagehand

stagehand action occasionally return two xpath which locates the same object but one of them successfully click the button while the other does not

Author: alexsiu398Created Dec 18, 2025Updated Sep 17, 2026

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.7

AI Provider:

  • Provider: gemini, cerebras
  • Model: gemini-2.0-flash, gemini-2.5-flash, gpt-oss-120b, llama-3.3-70b

Issue Description

stagehand action return two xpath locates the same object but one of them successfully click the button while the other does not

Steps to Reproduce

  1. stagehand action to click a login button
  2. check the results

Minimal Reproduction Code

import
from stagehand import Stagehand

async def main():
    stagehand = Stagehand(
        env="LOCAL",
        model_name="google/gemini-2.5-flash",
        model_api_key=os.getenv("GOOGLE_API_KEY")
    )
    await stagehand.init()
    page = stagehand.page
    
    await page.goto("https://mywebapp.com")
    
    # Act on the page
    await page.act("Click the Login button")
    await page.act("Input email [email protected]")

    await stagehand.close()

if __name__ == "__main__":
    asyncio.run(main())

Error Messages / Log trace

correctly click the button xpath=/html/body[1]/div[1]/div[1]/div[2]/nav[1]/div[1]/div[3]/button[1]/span[1]
cannot click the button xpath=/html/body[1]/div[3]/div[1]/div[1]/div[1]/div[1]/form[1]/div[3]/button[1].

Screenshots / Videos

[Attach screenshots or videos here]

Related Issues

Are there any related issues or PRs?

  • Related to: #[issue number]
  • Duplicate of: #[issue number]
  • Blocks: #[issue number]