DocsScreenshots & Visualbrowser_screenshot

browser_screenshot

Browser Screenshot

Capture a PNG screenshot with configurable modes. 'viewport' (default) captures the current visible area, 'element' captures a specific element by CSS selector or natural language description, 'fullpage' captures the entire scrollable page. Returns base64-encoded image data. Screenshots capture exactly as rendered, including all dynamic content, images, and styling. Useful for visual verification, debugging, and AI vision analysis.

Usage Example

1234567891011
import asyncio
from owl_browser import OwlBrowser, RemoteConfig
# Async usage
async with OwlBrowser(config) as browser:
context = await browser.create_context()
context_id = context["context_id"]
await browser.screenshot(
context_id=context_id
)

Parameters

Required

context_idstringrequired

The unique identifier of the browser context (e.g., 'ctx_000001')

Optional

modeenum
viewportelementfullpage

Screenshot mode: 'viewport' (default, current visible view), 'element' (specific element by selector), 'fullpage' (entire scrollable page)

selectorstring

CSS selector or natural language description for the element to capture. Required when mode is 'element'. Examples: 'div.profile', '#submit-btn', 'the login form'

scalestring

Scale percentage for the output image (1-100). Default is 100 (no scaling). Example: 50 will return an image at 50%% of the original size (half width and height).

Response

Returns a JSON object with the operation result.

{
  "success": true,
  "result": <value>
}