113 / 168 · 01 Agent Skills for Browser Automation · WebDriver BiDi Protocol Overview← prev⊞ allnext →☰ Read as one page
15.5Key Concepts
Browsing Context
A "browsing context" is a tab or iframe. Each has a unique ID.
Browser
├── Context "ctx-1" (Tab 1 - https://example.com)
│ ├── Context "ctx-2" (iframe - ad)
│ └── Context "ctx-3" (iframe - widget)
└── Context "ctx-4" (Tab 2 - https://docs.example.com)
User Context
User contexts provide isolation (like incognito profiles):
// Create isolated context
{"id": 1, "method": "browser.createUserContext", "params": {}}
// Create tab in isolated context
{"id": 2, "method": "browsingContext.create", "params": {
"type": "tab",
"userContext": "user-ctx-1"
}}
Event Subscriptions
Clients must explicitly subscribe to events they want:
// Subscribe to console logs and network events
{"id": 1, "method": "session.subscribe", "params": {
"events": ["log.entryAdded", "network.beforeRequestSent"],
"contexts": ["ctx-1"] // Optional: only for specific tab
}}