Skip to content

Add one-shot capture APIs to Java - #374

Merged
vincebln2 merged 4 commits into
VibiumDev:mainfrom
vincebln2:feat/java-capture-367
Aug 19, 2026
Merged

Add one-shot capture APIs to Java#374
vincebln2 merged 4 commits into
VibiumDev:mainfrom
vincebln2:feat/java-capture-367

Conversation

@vincebln2

Copy link
Copy Markdown
Collaborator

Fixes #367.

Java exposed persistent event listeners but none of the one-shot capture surface available in JavaScript and Python. Callers had to build their own listener, ordering, timeout, and cleanup around every action.

What changed

  • Added page.capture() with typed request, response, navigation, download, dialog, and generic event capture methods
  • Every method installs its listener before starting the action and removes exactly that listener on success, timeout, interruption, or action failure
  • Capture actions run on a daemon executor. The event can return while an action is blocked by a native dialog, so Java does not inherit the capture.dialog deadlock tracked in capture.dialog(fn) deadlocks when fn calls page.evaluate("alert(...)") (Python Client) #146
  • Added Java navigation event delivery for load, fragment, and history updates

Verified:

  • Focused CaptureTest: 7/7 green on Chrome
  • Tests cover all capture families, the blocking alert reproduction, generic console capture, action failure, timeout, and reuse after cleanup
  • validateCapabilityMarkers and compileTestJava green
  • Fork CI covers the complete Chrome and Firefox suites

@vincebln2
vincebln2 merged commit 59dad26 into VibiumDev:main Aug 19, 2026
3 checks passed
vincebln2 added a commit that referenced this pull request Aug 19, 2026
The audit predates today's merges: Java now has page.capture() with
request, response, navigation, event, download, and dialog (the action
argument is required, unlike the optional callback in JS and Python),
and request.postData() from the shared data collector.
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.

Java client: add capture APIs to match JavaScript and Python

1 participant