Skip to content

Ability to click elements by text, not by ref #288

@radiantspace

Description

@radiantspace

What's really lacking is ability to refer elements by their text, as we have in playwright proper. So if we have that information in the snapshot, why don't allow that with playwright-cli click command? Ofc agents can read snapshots for every step, but thats sub optimal.

The use case is a custom skill I make with playwright and it has something like that:

playwright-cli click f3e519 # click "Add filter" button
playwright-cli click f3e529 # click "Date" filter option
playwright-cli click f3e572 # click "Newest created" option

What I want to have is human readable and something that can be immediately reasoned about (and those are well documented playwright APIs honestly, so LLMs should also be able to apply those):

playwright-cli click "button[aria-label='Add filter']"
playwright-cli click "button[role='menuitem']:has-text('Newest created')"
playwright-cli click "button[has-text='Alt tag is empty']"

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