DocsFrame Handlingbrowser_switch_to_frame

browser_switch_to_frame

Browser Switch To Frame

Switch the browser context to interact with an iframe. After switching, all subsequent operations (click, type, etc.) target elements within that frame. Use frame name, index, or CSS selector.

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.switch_to_frame(
context_id=context_id,
frame_selector="value"
)

Parameters

Required

context_idstringrequired

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

frame_selectorstringrequired

Frame identifier: name attribute, frame index as string (e.g., '0', '1'), or CSS selector for iframe element

Response

Returns a JSON object with the operation result.

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