Skip to content

fix: use browser.getLocator() for ref support in all commands#670

Open
juliobrasa wants to merge 1 commit intovercel-labs:mainfrom
juliobrasa:fix/get-value-ref-support
Open

fix: use browser.getLocator() for ref support in all commands#670
juliobrasa wants to merge 1 commit intovercel-labs:mainfrom
juliobrasa:fix/get-value-ref-support

Conversation

@juliobrasa
Copy link

Summary

  • Replaces page.locator(command.selector) with browser.getLocator(command.selector) in 13 command handlers
  • Enables @ref arguments (like @e1 from snapshots) to work in all commands

Problem

Multiple commands used page.locator() directly which only accepts CSS selectors. When users passed @ref arguments from snapshot output, they got:

Error: Unsupported token @e2 while parsing css selector "@e2"

browser.getLocator() handles both refs and CSS selectors, and was already used by some commands but not consistently.

Affected commands

innerText, innerHTML (content), innerHTML (html), highlight, clear, selectText, setvalue, dispatch, count, boundingBox, nth, scroll (hover target), multiselect, screenshot (selector)

Test plan

  • TypeScript compiles cleanly
  • No behavioral change for CSS selector users — getLocator falls back to page.locator()

Fixes #128

🤖 Generated with Claude Code

Multiple commands (innerText, innerHTML, highlight, clear, selectText,
setvalue, dispatch, count, boundingBox, nth, scroll hover, multiselect,
screenshot) were using page.locator() directly instead of
browser.getLocator(), which meant @ref arguments (like @e1) would fail
with "Unsupported token" CSS parsing errors.

Now all commands consistently use browser.getLocator() which handles
both ref resolution and regular CSS selectors.

Fixes vercel-labs#128

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link
Contributor

vercel bot commented Mar 6, 2026

Someone is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

get value @ref fails with 'Unsupported token' error - refs not supported

1 participant