get_screenshot method captures a screenshot of the current browser window and returns it as base64-encoded image data along with metadata. Unlike taking screenshots through the agent method (which saves files to disk), this method returns the screenshot data programmatically.
This method returns screenshot data directly in your code rather than saving it to disk. If you need screenshots saved automatically to your Downloads folder, use the agent method with a prompt like “take a screenshot of this page” instead.
Method Signature
Parameters
Maximum time in seconds to wait for the screenshot capture to complete. If
None, uses the default system timeout.Return Value
Returns aGetScreenshotResponse object with the following structure:
The screenshot image encoded as a base64 string. This can be decoded and saved to a file, displayed, or processed programmatically.
A suggested filename for the screenshot, typically in a format like “Screenshot 2026-01-14 at 10.54.54 AM”.
The MIME type of the image format (e.g., “image/png”, “image/jpeg”).
ISO 8601 formatted timestamp indicating when the screenshot was captured.