Repository navigation
Add scraping_browser_hover_ref and a force option for click_ref - #206
Merged
romanv-brd merged 1 commit intoDec 1, 2026
Merged
Conversation
Hover moves the mouse over an element by ref so menus, tooltips and other content shown on hover can be opened. click_ref takes an optional force that skips Playwright's actionability checks; the click is still sent at the element's position. Closes brightdata#205
romanv-brd
force-pushed
the
feat/browser-hover-force-click
branch
from
December 1, 2026 09:53
58297c5 to
7d3c83c
Compare
Collaborator
|
merged, thank you ! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
scraping_browser_click_refalways callslocator.click({timeout: 5000}), so there is no way to skip Playwright's actionability checks, and there is no tool to hover an element. Content that only appears on hover (menus, tooltips,jsaction="mouseenter:..."badges) can't be reached.Change
scraping_browser_hover_ref(ref,element) callslocator.hover({timeout: 5000}). It is in thebrowsergroup,manifest.json, the README table andassets/Tools.md. Its annotations matchscraping_browser_scroll_to_ref(read-only, not destructive, open world).scraping_browser_click_reftakes an optionalforceboolean that is passed tolocator.click. The default is false, so the current behaviour doesn't change.One note on
force: it skips the stable, enabled and not-covered checks, but Playwright still sends the click at the element's position. If another element covers the target, the covering element receives the click. The parameter description and the docs say so, and a test pins this behaviour so agents aren't told thatforceclicks "through" an overlay. For a cover like the one in #205, hovering first (to open what the widget expects) is the more likely fix.Tests
New
test/browser-hover-force.test.js:test/browser-session-references.test.js: local Chromium over CDP, with refs from a filtered snapshot. It calls each tool's ownexecute. The credential lookup is answered in-process by an axios adapter, andref_locatorresolves on the local page, so there are no network calls. It checks::hovermenu item that then appears in a new snapshot and can be clickedmouseenterhandlersaria-disabledbutton fails with "not enabled", andforce: trueclicks itforce: truelands on the coverThe two force cases fail if
forceisn't passed through.Commands run locally (Node 22.17):
node --test test/browser-hover-force.test.js test/annotations.test.js test/browser-session-references.test.js test/package-files.test.js: 24 passed, 0 failednpm test: 201 passed, 1 failed, 14 cancelled, 7 skipped. Onmainit is 200 passed, 1 failed, 14 cancelled, 6 skipped, with the same failures:test/packed-install.test.jsfails because the local npm install returns ETARGET forplaywright-core@1.64.1test/search-utils.test.jstests are cancelled with "Promise resolution is still pending" under Node 22 (CI uses Node 24)The Chromium build that Playwright 1.64.1 expects isn't installed on my machine, so I ran the real-browser tests with Playwright's cached headless shell through a local
--importpreload. That preload isn't part of this PR. In CI,npx playwright install --with-deps chromiumprovides the browser and the test runs as written.Closes #205