> ## Documentation Index
> Fetch the complete documentation index at: https://docs.narada.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# get_screenshot

> Capture a screenshot of the current browser window and retrieve it as base64-encoded image data using the Python SDK

The `get_screenshot` method captures a screenshot of the current browser window and returns it as base64-encoded image data along with metadata. Unlike asking `Agent.run()` to take a screenshot and save it to disk, this method returns the screenshot data programmatically.

<Note>
  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 `Agent.run()` with a prompt like "take a screenshot of this page" instead.
</Note>

## Method Signature

```python theme={null}
async def get_screenshot(
    self,
    *,
    timeout: int | None = None,
) -> GetScreenshotResponse
```

## Parameters

<ParamField query="timeout" type="int | None" default="None">
  Maximum time in seconds to wait for the screenshot capture to complete. If `None`, uses the default system timeout.

  ```python theme={null}
  timeout=30     # Wait up to 30 seconds
  timeout=None   # Use default timeout
  ```
</ParamField>

## Return Value

Returns a `GetScreenshotResponse` object with the following structure:

<ResponseField name="base64_content" type="str" required>
  The screenshot image encoded as a base64 string. This can be decoded and saved to a file, displayed, or processed programmatically.
</ResponseField>

<ResponseField name="name" type="str" required>
  A suggested filename for the screenshot, typically in a format like "Screenshot 2026-01-14 at 10.54.54 AM".
</ResponseField>

<ResponseField name="mime_type" type="str" required>
  The MIME type of the image format (e.g., "image/png", "image/jpeg").
</ResponseField>

<ResponseField name="timestamp" type="str" required>
  ISO 8601 formatted timestamp indicating when the screenshot was captured.
</ResponseField>

## Example

```python theme={null}
import asyncio
import base64

from narada import Agent, BrowserEnvironment

async def main():
    env = BrowserEnvironment()
    agent = Agent(environment=env)

    try:
        # Navigate to a page
        await agent.go_to_url(url="https://example.com")

        # Capture a screenshot
        response = await agent.get_screenshot()

        # Decode and save the screenshot
        image_data = base64.b64decode(response.base64_content)
        extension = response.mime_type.split('/')[1]  # "png" or "jpeg"
        filename = f"{response.name}.{extension}"

        with open(filename, "wb") as f:
            f.write(image_data)

        print(f"Screenshot saved as {filename}")
        print(f"Captured at: {response.timestamp}")
    finally:
        await env.close()

if __name__ == "__main__":
    asyncio.run(main())
```
