Repository navigation
Conversation
The rules `codemode:browser` adds to its description show how to save
a screenshot with `Page.captureScreenshot`, with no format, so models
that copy it take a PNG. A PNG of a 1440x900 window can come to 1.6
MB, over the 1 MiB one host call can return, and the call fails.
Pass `params: { format: "jpeg", quality: 80 }` in the example, ask
for a `.jpg` file name, and say why in the rule.
🦋 Changeset detectedLatest commit: ecb3567 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
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.
Models copy the screenshot example in
codemode:browser's description. The example passes no format, so they take a PNG, and a PNG of a whole window is often over the 1 MiB one call can return. In one session a 1440x900 page came to 1.6 MB: the agent's first screenshot failed, and it only got one after retrying as a JPEG.The example now takes a JPEG, asks for a
.jpgfile name, and says why:const { data } = await browser.cdp({ method: "Page.captureScreenshot", + params: { format: "jpeg", quality: 80 }, sessionId: "active", });The limits and the error for an oversized result are unchanged, so a screenshot that is still too large fails with the same message as before. Quality 80 is a starting point: it has not been measured against very large windows.
A test in
browser.test.tschecks the new text, and the sentence about screenshots indocs/17_isolate_javascript.mdnow matches it. A patch changeset is included.