Skip to content

Stagehand sometimes attempts to click on text nodes instead of element nodes #824

@MrHaikuSwan

Description

@MrHaikuSwan

Right now, Stagehand sometimes tries to call Playwright methods on text nodes instead of elements.

If the HTML markup translates clickable elements into StaticText nodes in the accessibility tree shown to the LLM, the LLM will select the StaticText node, which translates to an XPath targeting the text node like so:

/html[1]/body[1]/div[1]/div[1]/text()[1]

When this happens, Playwright operations will fail -- I set up a simple reproduction of this happening here.

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