mirror of
https://github.com/Tencent/BrowserSkill.git
synced 2026-09-10 13:01:23 +08:00
fix(screenshot): fall back to CDP capture when captureVisibleTab fails (#83)
chrome.tabs.captureVisibleTab reads back the window surface, which fails outright on some Windows/Chrome combinations (Chromium FAILURE_REASON_READBACK_FAILED: "Failed to capture tab: image readback failed"), leaving full-tab screenshots without any working path. Capture the full tab via CDP Page.captureScreenshot (fromSurface) when the visible-tab capture rejects; the CDP path goes through the renderer BeginFrame pipeline instead of the surface readback. When both paths fail, return cdp_failed with data.reason=screenshot_capture_failed carrying both underlying messages, and render a CLI hint that points at the browser-side readback cause. Refs #71
This commit is contained in:
@@ -31,7 +31,8 @@ export type RpcErrorReason =
|
||||
| "single_select_value_count"
|
||||
| "tab_not_active"
|
||||
| "restricted_tab_url"
|
||||
| "borrow_conflict";
|
||||
| "borrow_conflict"
|
||||
| "screenshot_capture_failed";
|
||||
|
||||
export interface RpcErrorData {
|
||||
reason?: RpcErrorReason;
|
||||
|
||||
Reference in New Issue
Block a user