Docsbrowser_set_content

browser_set_content

Browser Set Content

Set the page's HTML content directly. Replaces the current page content with the provided HTML. The page URL will be 'about:blank'. Useful for rendering HTML templates, testing, or injecting content without making a network request.

Usage Example

123456789101112
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.set_content(
context_id=context_id,
html="value"
)

Parameters

Required

context_idstringrequired

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

htmlstringrequired

The HTML content to set as the page body. Can be a full HTML document or a fragment. The page URL will be set to 'about:blank'

Response

Returns a JSON object with the operation result.

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