Skip to content

Conversation

@seanmcguire12
Copy link
Member

why

  • act() is currently unable to call hover()

what changed

  • added hover() to SupportedPlaywrightAction enum & UnderstudyMethodHandlerContext interface

test plan

  • this is change is pretty benign. existing act evals & unit tests should suffice

@seanmcguire12 seanmcguire12 added the act These changes pertain to the act function label Nov 7, 2025
@changeset-bot
Copy link

changeset-bot bot commented Nov 7, 2025

🦋 Changeset detected

Latest commit: a6c84e2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@browserbasehq/stagehand Patch
@browserbasehq/stagehand-evals Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Greptile Summary

Added support for the hover() action in the act() method to enable mouse hover interactions on elements.

The changes integrate the existing Locator.hover() method (packages/core/lib/v3/understudy/locator.ts:315) into the act handler system by:

  • Adding HOVER = "hover" to the SupportedPlaywrightAction enum
  • Registering hover in METHOD_HANDLER_MAP
  • Creating a new hover() handler function that wraps locator.hover() with proper error handling and logging

The implementation follows the established pattern used by other action handlers like selectOption() and doubleClick(), ensuring consistency with the codebase. The underlying Locator.hover() method already has test coverage in packages/core/lib/v3/tests/locator-input-methods.spec.ts.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes are minimal, well-structured, and follow existing patterns. The hover() method already exists in the Locator class with test coverage, and this PR simply wires it into the act() handler system. No new logic or edge cases are introduced - only integration code.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
.changeset/breezy-phones-happen.md 5/5 Standard changeset file for documenting the patch-level change to allow act() to call hover()
packages/core/lib/v3/types/private/handlers.ts 5/5 Added HOVER enum value to SupportedPlaywrightAction, consistent with naming conventions
packages/core/lib/v3/handlers/handlerUtils/actHandlerUtils.ts 5/5 Added hover handler to METHOD_HANDLER_MAP and implemented hover() function following existing pattern with proper error handling and logging

Sequence Diagram

sequenceDiagram
    participant User
    participant ActHandler
    participant performUnderstudyMethod
    participant METHOD_HANDLER_MAP
    participant hover
    participant Locator

    User->>ActHandler: act("hover over element")
    ActHandler->>ActHandler: Build act prompt with SupportedPlaywrightAction.HOVER
    ActHandler->>ActHandler: Get LLM inference with hover method
    ActHandler->>performUnderstudyMethod: Call with method="hover"
    performUnderstudyMethod->>performUnderstudyMethod: Resolve locator for element
    performUnderstudyMethod->>METHOD_HANDLER_MAP: Lookup handler for "hover"
    METHOD_HANDLER_MAP->>hover: Execute hover handler
    hover->>Locator: Call locator.hover()
    Locator->>Locator: Scroll element into view
    Locator->>Locator: Get element box model
    Locator->>Locator: Dispatch mouse move to center
    Locator-->>hover: Success
    hover-->>performUnderstudyMethod: Complete
    performUnderstudyMethod-->>ActHandler: Action completed
    ActHandler-->>User: ActResult
Loading

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@seanmcguire12 seanmcguire12 merged commit a224b33 into main Nov 8, 2025
16 of 29 checks passed
miguelg719 pushed a commit that referenced this pull request Nov 14, 2025
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @browserbasehq/stagehand@3.0.2

### Patch Changes

- [#1245](#1245)
[`a224b33`](a224b33)
Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - allow act()
to call hover()

- [#1234](#1234)
[`6fc9de2`](6fc9de2)
Thanks [@miguelg719](https://github.com/miguelg719)! - Add a
page.sendCDP method

- [#1233](#1233)
[`4935be7`](4935be7)
Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - extend
page.screenshot() options to mirror playwright

- [#1232](#1232)
[`bdd76fc`](bdd76fc)
Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - export Page
type

- [#1229](#1229)
[`7ea18a4`](7ea18a4)
Thanks [@tkattkat](https://github.com/tkattkat)! - Adjust extract tool +
expose extract response in agent result

- [#1239](#1239)
[`d4de014`](d4de014)
Thanks [@miguelg719](https://github.com/miguelg719)! - Fix
stagehand.metrics on api mode

- [#1241](#1241)
[`2d1b573`](2d1b573)
Thanks [@miguelg719](https://github.com/miguelg719)! - Return response
on page.goto api mode

- [#1253](#1253)
[`5556041`](5556041)
Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - fix missing
page issue when connecting to existing browser

- [#1235](#1235)
[`7e4b43e`](7e4b43e)
Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - make
page.goto() return a Response object

- [#1254](#1254)
[`7e72adf`](7e72adf)
Thanks [@sameelarif](https://github.com/sameelarif)! - Added custom
error types to allow for a smoother debugging experience.

- [#1227](#1227)
[`9bf09d0`](9bf09d0)
Thanks [@miguelg719](https://github.com/miguelg719)! - Fix readme's
media links and add instructions for installing from a branch

- [#1257](#1257)
[`92d32ea`](92d32ea)
Thanks [@tkattkat](https://github.com/tkattkat)! - Add support for a
custom baseUrl with google cua client

- [#1230](#1230)
[`ebcf3a1`](ebcf3a1)
Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - add
stagehand.browserbaseSessionID getter

- [#1262](#1262)
[`c29a4f2`](c29a4f2)
Thanks [@miguelg719](https://github.com/miguelg719)! - Remove error
throwing when api and experimental are both set

- [#1223](#1223)
[`6d21efa`](6d21efa)
Thanks [@miguelg719](https://github.com/miguelg719)! - Disable api mode
when using custom LLM clients

- [#1228](#1228)
[`525ef0c`](525ef0c)
Thanks [@Kylejeong2](https://github.com/Kylejeong2)! - update slack link
in docs

- [#1226](#1226)
[`9ddb872`](9ddb872)
Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - add support
for page.on('console') events

## @browserbasehq/stagehand-evals@1.1.2

### Patch Changes

- Updated dependencies
\[[`a224b33`](a224b33),
[`6fc9de2`](6fc9de2),
[`4935be7`](4935be7),
[`bdd76fc`](bdd76fc),
[`7ea18a4`](7ea18a4),
[`d4de014`](d4de014),
[`2d1b573`](2d1b573),
[`5556041`](5556041),
[`7e4b43e`](7e4b43e),
[`7e72adf`](7e72adf),
[`9bf09d0`](9bf09d0),
[`92d32ea`](92d32ea),
[`ebcf3a1`](ebcf3a1),
[`c29a4f2`](c29a4f2),
[`6d21efa`](6d21efa),
[`525ef0c`](525ef0c),
[`9ddb872`](9ddb872)]:
    -   @browserbasehq/stagehand@3.0.2

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

act These changes pertain to the act function

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants