Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 1e74ca99e9400c251d274661f1fdeeed0dbda10c
https://github.com/WebKit/WebKit/commit/1e74ca99e9400c251d274661f1fdeeed0dbda10c
Author: Timothy Olusanya <[email protected]>
Date: 2026-09-17 (Thu, 17 Sep 2026)
Changed paths:
M Source/WebKit/UIProcess/Automation/BidiBrowsingContextAgent.cpp
M Source/WebKit/UIProcess/Automation/BidiBrowsingContextAgent.h
M Source/WebKit/UIProcess/Automation/WebDriverBidiProcessor.cpp
M Source/WebKit/UIProcess/Automation/protocol/BidiBrowsingContext.json
M WebDriverTests/TestExpectations.json
Log Message:
-----------
[WebDriver BiDi] Implement browsingContext.captureScreenshot command plumbing
https://bugs.webkit.org/show_bug.cgi?id=288325
Reviewed by BJ Burg.
Add the browsingContext.captureScreenshot protocol command and implement its
initial
handler. The command resolves top-level and child browsing context handles
using the
existing BiDi browsing-context path and delegates capture to
WebAutomationSession::takeScreenshot, which also backs classic WebDriver
screenshots.
Captures are always taken from the containing page's viewport; capturing the
navigable
itself for child contexts is part of the remaining work below.
Validate the context, origin, image format, clip, and image-size parameter
shapes before
dispatching the capture. Invalid parameter shapes produce invalid argument,
unknown or closed
contexts produce no such frame, unresolved element shared references produce no
such
node, and empty box clips produce unable to capture screen.
This is the command-plumbing and validation portion of the implementation. The
remaining
work is tracked in dedicated bugs blocking webkit.org/b/288325: capturing a
document
origin and applying box or element clipping (webkit.org/b/323419), encoding
JPEG images
and honoring quality (webkit.org/b/323422), and resolving element shared
references
(webkit.org/b/323423). Complete child-frame screenshot behavior remains with
webkit.org/b/288325.
Update the WebDriver WPT expectations now that all 71 invalid-parameter tests
pass. Keep
the unsupported capture geometry and encoding cases expected to fail, while
allowing the
two origin consistency tests to pass. capture_screenshot.py remains expected to
fail for
a reason unrelated to the capture itself: its tests read the viewport
dimensions back
through script.evaluate, which currently fails deserializing the result.
Tests: imported/w3c/webdriver/tests/bidi/browsing_context/capture_screenshot/
* Source/WebKit/UIProcess/Automation/BidiBrowsingContextAgent.cpp:
(WebKit::BidiBrowsingContextAgent::captureScreenshot): Add the command handler,
parameter
validation, context resolution, and delegation to the existing screenshot
implementation.
* Source/WebKit/UIProcess/Automation/BidiBrowsingContextAgent.h:
Declare captureScreenshot as a BidiBrowsingContextBackendDispatcherHandler
method.
* Source/WebKit/UIProcess/Automation/WebDriverBidiProcessor.cpp:
(WebKit::toBidiErrorCode): Map NodeNotFound to the BiDi no such node error code;
stale element reference is not a WebDriver BiDi error code, and no BiDi test
relies
on the previous string.
* Source/WebKit/UIProcess/Automation/protocol/BidiBrowsingContext.json:
Define ImageFormat and ClipRectangle and register the captureScreenshot command.
* WebDriverTests/TestExpectations.json:
Remove the invalid.py failure expectation and narrow the origin.py expectation
to
test_origin, which requires document-origin capture.
Canonical link: https://commits.webkit.org/321353@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications