accept locators for screenshot mask in golang sdk - #2656
Merged
Conversation
|
seanmcguire12
marked this pull request as ready for review
August 9, 2026 21:30
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 3 files
Architecture diagram
sequenceDiagram
participant Caller as Go SDK Caller
participant Page as Page.Screenshot
participant Conv as screenshotProtocolOptions
participant Desc as locatorDescriptorsForScreenshot
participant RPC as Protocol Client (rpc.call)
Caller->>Page: Screenshot(ctx, &ScreenshotOptions{Mask: []*PageLocator})
Page->>Page: Get target pageID
Page->>Conv: screenshotProtocolOptions(options, pageID)
alt options == nil
Conv-->>Page: nil protocol options
else options != nil
Conv->>Conv: Copy non-mask options to PageScreenshotOptions
alt options.Mask != nil
Conv->>Desc: locatorDescriptorsForScreenshot(mask, pageID)
loop each mask locator
Desc->>Desc: locator.Descriptor() -> pageId, selector, nth
alt locator.PageID != pageID
Desc-->>Page: error: mask locator must belong to the target page
Page-->>Caller: error (no RPC sent)
end
end
Desc-->>Conv: []LocatorDescriptor
Conv->>Conv: Set protocolOptions.Mask
end
Conv-->>Page: *PageScreenshotOptions
end
Page->>RPC: page.screenshot (PageScreenshotParams)
RPC-->>Page: PageScreenshotResult (base64 data)
Page->>Page: Decode base64 payload
Page-->>Caller: []byte screenshot
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
seanmcguire12
force-pushed
the
locator-inputs
branch
from
August 9, 2026 23:55
fbf39ac to
6362f37
Compare
seanmcguire12
force-pushed
the
go-screenshot-mask-parity
branch
from
August 10, 2026 01:08
ad42af0 to
c30f5c8
Compare
miguelg719
approved these changes
Aug 10, 2026
seanmcguire12
force-pushed
the
go-screenshot-mask-parity
branch
from
August 10, 2026 02:41
c30f5c8 to
0baf98c
Compare
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.
why
what changed
ScreenshotOptionstype forPage.ScreenshotScreenshotOptions.Maskto accept[]*PageLocatorLocatorDescriptorvalues before sending thepage.screenshotRPCSDK Shape
Go:
behavioural notes:
Page.Screenshotstill returns decoded screenshot bytesnilscreenshot options still send no protocol optionsLocatorDescriptorvalues internally, includingpageId,selector, and optionalnthtest plan
ScreenshotOptionsconversion to generated protocol options*PageLocatormask serialization, includingnthSummary by cubic
Go SDK: Page.Screenshot now accepts page-bound locator masks with strict validation while keeping screenshot behavior unchanged. This also moves act/observe/extract to locator-based scoping across SDKs, updates snapshotting, and standardizes examples to read result data via
.data.New Features
Page.ScreenshotMaskaccepts[]*PageLocator; nil and cross-page locators are rejected; converts to protocol descriptors before RPC.act/observe/extractacceptlocatorandignoreLocators(with.nth), validate same-page locators, and serialize in TS batch callbacks.focusLocator/ignoreLocators; locator-scoped calls bypass server cache (responses show cache statusDISABLED).Migration
*PageScreenshotOptionswith*ScreenshotOptions; passpage.Locator("...")inMask.selector/ignoreSelectorswithlocator/ignoreLocatorsforact/observe/extractin TS/Python/Go; use.nth(index)when needed.result.datainstead of the full response.Written for commit 0baf98c. Summary will update on new commits.